File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,8 @@ def _headers(cls, custom_headers) -> dict:
26
26
@classmethod
27
27
def _auth (cls , ** kwargs ):
28
28
if not cls ._requests_auth :
29
- cls ._requests_auth = Config .get_auth_class ().requests_auth (
30
- Config .access_key , Config .secret_key , ** kwargs
31
- )
32
- return cls ._requests_auth
29
+ cls ._requests_auth = Config .get_auth_class ().requests_auth
30
+ return cls ._requests_auth (Config .access_key , Config .secret_key , ** kwargs )
33
31
34
32
@staticmethod
35
33
def handle_api_response (response ):
Original file line number Diff line number Diff line change @@ -20,11 +20,21 @@ class StaxApiTests(unittest.TestCase):
20
20
21
21
def setUp (self ):
22
22
self .Api = Api
23
- self .Api ._requests_auth = ( "username" , "password" )
23
+ self .Api ._requests_auth = lambda x , y : ( x , y )
24
24
25
25
def testAuth (self ):
26
+
27
+ Config .access_key = "1"
28
+ Config .secret_key = "2"
29
+
30
+ auth = self .Api ._auth ()
31
+ self .assertEqual (self .Api ._requests_auth ("1" , "2" ), auth )
32
+
33
+ Config .access_key = "3"
34
+ Config .secret_key = "4"
35
+
26
36
auth = self .Api ._auth ()
27
- self .assertEqual (self .Api ._requests_auth , auth )
37
+ self .assertEqual (self .Api ._requests_auth ( "3" , "4" ) , auth )
28
38
29
39
@responses .activate
30
40
def testGet (self ):
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class StaxClientTests(unittest.TestCase):
21
21
22
22
def setUp (self ):
23
23
self .Api = Api
24
- self .Api ._requests_auth = ( "username" , "password" )
24
+ self .Api ._requests_auth = lambda x , y : ( x , y )
25
25
26
26
self .account_client = StaxClient ("accounts" )
27
27
self .workload_client = StaxClient ("workloads" )
You can’t perform that action at this time.
0 commit comments