File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,18 @@ def test_lessknown_host_will_return_a_set_of_v1_endpoints(self):
29
29
self .assertNotIn ('v2.0' , a .token_endpoint )
30
30
31
31
def test_unknown_host_wont_pass_instance_discovery (self ):
32
- with self .assertRaisesRegexp (ValueError , "invalid_instance" ):
33
- Authority ('https://unknown.host/tenant_doesnt_matter_in_this_case' )
34
-
35
- def test_invalid_host_skipping_validation_meets_connection_error_down_the_road (self ):
36
- with self .assertRaises (requests .exceptions .RequestException ):
37
- Authority ('https://unknown.host/invalid' , validate_authority = False )
32
+ _assert = getattr (self , "assertRaisesRegex" , self .assertRaisesRegexp ) # Hack
33
+ with _assert (ValueError , "invalid_instance" ):
34
+ Authority ('https://example.com/tenant_doesnt_matter_in_this_case' )
35
+
36
+ def test_invalid_host_skipping_validation_can_be_turned_off (self ):
37
+ try :
38
+ Authority ('https://example.com/invalid' , validate_authority = False )
39
+ except ValueError as e :
40
+ if "invalid_instance" in str (e ): # Imprecise but good enough
41
+ self .fail ("validate_authority=False should turn off validation" )
42
+ except : # Could be requests...RequestException, json...JSONDecodeError, etc.
43
+ pass # Those are expected for this unittest case
38
44
39
45
40
46
class TestAuthorityInternalHelperCanonicalize (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments