44import time
55
66import pytest
7- from cloudshell .sandbox_rest .sandbox_api import SandboxRestApiSession
8- from constants import *
97from common import *
8+ from constants import *
9+
10+ from cloudshell .sandbox_rest .sandbox_api import SandboxRestApiSession
1011
1112
1213@pytest .fixture (scope = "module" )
1314def blueprint_id (admin_session : SandboxRestApiSession , empty_blueprint ):
1415 res_id = get_blueprint_id_from_name (admin_session , empty_blueprint )
15- assert ( type (res_id ) is str )
16+ assert type (res_id ) is str
1617 return res_id
1718
1819
1920@pytest .fixture (scope = "module" )
2021def sandbox_id (admin_session : SandboxRestApiSession , blueprint_id ):
2122 # start sandbox
22- start_res = admin_session .start_sandbox (
23- blueprint_id = blueprint_id , sandbox_name = "Pytest empty blueprint test"
24- )
23+ start_res = admin_session .start_sandbox (blueprint_id = blueprint_id , sandbox_name = "Pytest empty blueprint test" )
2524 sandbox_id = start_res ["id" ]
2625 print (f"Sandbox started: { sandbox_id } " )
2726 yield sandbox_id
@@ -43,63 +42,62 @@ def setup_execution_id(admin_session: SandboxRestApiSession, sandbox_id: str):
4342 counter += 1
4443
4544 print ("Rerunning Setup..." )
46- res = admin_session .run_sandbox_command (sandbox_id = sandbox_id ,
47- command_name = BLUEPRINT_SETUP_COMMAND )
48- assert (type (res ) is dict )
45+ res = admin_session .run_sandbox_command (sandbox_id = sandbox_id , command_name = BLUEPRINT_SETUP_COMMAND )
46+ assert type (res ) is dict
4947 print ("Setup re-run execution response" )
5048 pretty_print_response (res )
5149 execution_id = res ["executionId" ]
5250 return execution_id
5351
5452
5553def test_start_stop (admin_session , sandbox_id ):
56- assert ( type (sandbox_id ) is str )
54+ assert type (sandbox_id ) is str
5755 print (f"Sandbox ID: { sandbox_id } " )
5856
5957
6058def test_get_sandbox_details (admin_session , sandbox_id ):
6159 details_res = admin_session .get_sandbox_details (sandbox_id )
62- assert ( type (details_res ) is dict )
60+ assert type (details_res ) is dict
6361 sb_name = details_res ["name" ]
6462 print (f"Pulled details for sandbox '{ sb_name } '" )
6563
6664
6765def test_get_components (admin_session , sandbox_id ):
6866 components_res = admin_session .get_sandbox_components (sandbox_id )
69- assert ( type (components_res ) is list )
67+ assert type (components_res ) is list
7068 component_count = len (components_res )
7169 print (f"component count found: { component_count } " )
7270
7371
7472def test_get_sandbox_commands (admin_session , sandbox_id ):
7573 commands_res = admin_session .get_sandbox_commands (sandbox_id )
76- assert ( type (commands_res ) is list )
74+ assert type (commands_res ) is list
7775 print (f"Sandbox commands: { [x ['name' ] for x in commands_res ]} " )
7876 first_sb_command = admin_session .get_sandbox_command_details (sandbox_id , commands_res [0 ]["name" ])
7977 print (f"SB command name: { first_sb_command ['name' ]} \n " f"description: { first_sb_command ['description' ]} " )
8078
8179
8280def test_get_sandbox_events (admin_session , sandbox_id ):
8381 activity_res = admin_session .get_sandbox_activity (sandbox_id )
84- assert ( type (activity_res ) is dict and "events" in activity_res )
82+ assert type (activity_res ) is dict and "events" in activity_res
8583 events = activity_res ["events" ]
8684 print (f"activity events count: { len (events )} " )
8785
8886
8987def test_get_console_output (admin_session , sandbox_id ):
9088 output_res = admin_session .get_sandbox_output (sandbox_id )
91- assert ( type (output_res ) is dict and "entries" in output_res )
89+ assert type (output_res ) is dict and "entries" in output_res
9290 entries = output_res ["entries" ]
9391 print (f"Sandbox output entries count: { len (entries )} " )
9492
9593
9694def test_get_instructions (admin_session , sandbox_id ):
9795 instructions_res = admin_session .get_sandbox_instructions (sandbox_id )
98- assert ( type (instructions_res ) is str )
96+ assert type (instructions_res ) is str
9997 print (f"Pulled sandbox instructions: '{ instructions_res } '" )
10098
10199
102100def test_extend_sandbox (admin_session , sandbox_id ):
103101 extend_response = admin_session .extend_sandbox (sandbox_id , "PT0H10M" )
104- assert ( type (extend_response ) is dict and "remaining_time" in extend_response )
102+ assert type (extend_response ) is dict and "remaining_time" in extend_response
105103 print (f"extended sandbox. Remaining time: { extend_response ['remaining_time' ]} " )
0 commit comments