diff --git a/oauthenticator/tests/test_cilogon.py b/oauthenticator/tests/test_cilogon.py index a00d5260..dda1a1fd 100644 --- a/oauthenticator/tests/test_cilogon.py +++ b/oauthenticator/tests/test_cilogon.py @@ -73,7 +73,7 @@ async def test_cilogon( print(f"Running test variation id {test_variation_id}") c = Config() c.CILogonOAuthenticator = Config(class_config) - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { "https://some-idp.com/login/oauth/authorize": { "username_derivation": { "username_claim": "name", @@ -377,7 +377,7 @@ async def test_cilogon_idps( c = Config() c.CILogonOAuthenticator = Config(class_config) test_idp = "https://some-idp.com/login/oauth/authorize" - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { test_idp: idp_config, } authenticator = CILogonOAuthenticator(config=c) @@ -504,16 +504,16 @@ async def test_config_idps_wrong_type(caplog): Test alllowed_idps is a dict """ c = Config() - c.CILogonOAuthenticator.allowed_idps = ['pink'] + c.CILogonOAuthenticator.idps = ['pink'] with raises(TraitError): CILogonOAuthenticator(config=c) async def test_config_idps_required_username_derivation(caplog): - # Test username_derivation is a required field of allowed_idps + # Test username_derivation is a required field of idps c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://github.com/login/oauth/authorize': {}, } @@ -523,11 +523,11 @@ async def test_config_idps_required_username_derivation(caplog): async def test_config_idps_invalid_entity_id(caplog): """ - Test allowed_idps keys cannot be domains, but only valid CILogon entity ids, + Test idps keys cannot be domains, but only valid CILogon entity ids, i.e. only fully formed URLs """ c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'uni.edu': { 'username_derivation': { 'username_claim': 'email', @@ -552,7 +552,7 @@ async def test_config_idps_invalid_entity_id(caplog): async def test_config_idps_invalid_type(caplog): c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://github.com/login/oauth/authorize': 'should-be-a-dict' } with raises(ValidationError, match="'should-be-a-dict' is not of type 'object'"): @@ -561,7 +561,7 @@ async def test_config_idps_invalid_type(caplog): async def test_config_idps_unrecognized_options(caplog): c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://github.com/login/oauth/authorize': { 'username_derivation': {'a': 1, 'b': 2} } @@ -572,7 +572,7 @@ async def test_config_idps_unrecognized_options(caplog): async def test_config_idps_domain_required(caplog): c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://github.com/login/oauth/authorize': { 'username_derivation': { 'username_claim': 'email', @@ -586,7 +586,7 @@ async def test_config_idps_domain_required(caplog): async def test_config_idps_prefix_required(caplog): c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://github.com/login/oauth/authorize': { 'username_derivation': { 'username_claim': 'email', @@ -603,7 +603,7 @@ async def test_config_scopes_validation(): Test that required scopes are appended if not configured. """ c = Config() - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://some-idp.com/login/oauth/authorize': { 'username_derivation': { 'username_claim': 'email', @@ -619,14 +619,14 @@ async def test_config_scopes_validation(): assert authenticator.scope == expected_scopes -async def test_allowed_idps_username_derivation_actions(cilogon_client): +async def test_idps_username_derivation_actions(cilogon_client): """ - Tests all `allowed_idps[].username_derivation.action` config choices: + Tests all `idps[].username_derivation.action` config choices: `strip_idp_domain`, `prefix`, and no action specified. """ c = Config() c.CILogonOAuthenticator.allow_all = True - c.CILogonOAuthenticator.allowed_idps = { + c.CILogonOAuthenticator.idps = { 'https://strip-idp-domain.example.com/login/oauth/authorize': { 'username_derivation': { 'username_claim': 'email',