22Test the api methods that do NOT require a blueprint
33Live Cloudshell server is still a dependency
44"""
5+ import pytest
56from constants import DEFAULT_EMPTY_BLUEPRINT
67
78from cloudshell .sandbox_rest .sandbox_api import SandboxRestApiSession
89
910
11+ @pytest .fixture (scope = "module" )
12+ def api_token (admin_session : SandboxRestApiSession ):
13+ token = admin_session .get_token_for_target_user ("admin" )
14+ return token
15+
16+
17+ def test_delete_token (admin_session : SandboxRestApiSession , api_token : str ):
18+ assert isinstance (api_token , str )
19+ print (f"Token response: '{ api_token } '" )
20+ admin_session .delete_token (api_token )
21+
22+
23+ def test_reset_session (admin_session : SandboxRestApiSession ):
24+ print ("\n deleting admin token..." )
25+ admin_session .invalidate_auth ()
26+ print ("logging back in.." )
27+ admin_session .refresh_auth_from_stored_credentials ()
28+ print ("Calling get blueprints..." )
29+ res = admin_session .get_blueprints ()
30+ assert isinstance (res , list )
31+ print (f"blueprint count { len (res )} " )
32+
33+
1034def test_get_sandboxes (admin_session : SandboxRestApiSession ):
1135 res = admin_session .get_sandboxes ()
1236 assert isinstance (res , list )
@@ -24,9 +48,3 @@ def test_get_default_blueprint(admin_session: SandboxRestApiSession):
2448 assert isinstance (bp_res , dict )
2549 bp_name = bp_res ["name" ]
2650 print (f"Pulled details for '{ bp_name } '" )
27-
28-
29- def test_get_and_delete_token (admin_session : SandboxRestApiSession ):
30- token_res = admin_session .get_token_for_target_user ("admin" )
31- assert isinstance (token_res , str )
32- print (f"Token response: '{ token_res } '" )
0 commit comments