diff --git a/okta/models/o_auth_grant_type.py b/okta/models/o_auth_grant_type.py index e5852e109..4f6d77287 100644 --- a/okta/models/o_auth_grant_type.py +++ b/okta/models/o_auth_grant_type.py @@ -38,3 +38,7 @@ class OAuthGrantType( DEVICE_CODE = "urn:ietf:params:oauth:grant-type:device_code", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:DEVICE_CODE" TOKEN_EXCHANGE = "urn:ietf:params:oauth:grant-type:token-exchange", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:TOKEN-EXCHANGE" INTERACTION_CODE = "interaction_code", "INTERACTION_CODE" + OTP = "urn:okta:params:oauth:grant-type:otp", "URN:OKTA:PARAMS:OAUTH:GRANT-TYPE:OTP" + OOB = "urn:okta:params:oauth:grant-type:oob", "URN:OKTA:PARAMS:OAUTH:GRANT-TYPE:OOB" + MFA_OTP = "http://auth0.com/oauth/grant-type/mfa-otp", "HTTP://AUTH0.COM/OAUTH/GRANT-TYPE/MFA-OTP" + MFA_OOB = "http://auth0.com/oauth/grant-type/mfa-oob", "HTTP://AUTH0.COM/OAUTH/GRANT-TYPE/MFA-OOB" diff --git a/tests/unit/test_applications_ut.py b/tests/unit/test_applications_ut.py index 1ff3bf806..fe87874c5 100644 --- a/tests/unit/test_applications_ut.py +++ b/tests/unit/test_applications_ut.py @@ -45,7 +45,8 @@ async def mock_response_text(): } ) provisioning_conn_req = models.ProvisioningConnectionRequest({'profile': profile}) - _ = await client.set_default_provisioning_connection_for_application('test_app_id', provisioning_conn_req, query_params={'activate': True}) + _ = await client.set_default_provisioning_connection_for_application('test_app_id', provisioning_conn_req, + query_params={'activate': True}) assert mock_http_request.request_info['url'].endswith('/apps/test_app_id/connections/default/?activate=True') data = mock_http_request.request_info['data'] assert json.loads(data) == {"profile": {"authScheme": "TOKEN", "token": "TEST"}} @@ -133,6 +134,7 @@ async def mock_response_text(): assert isinstance(features[0].capabilities.update.password.change, models.ChangeEnum) assert isinstance(features[0].status, models.EnabledStatus) + @pytest.mark.asyncio async def test_get_feature_for_application(monkeypatch, mocker): mocked_response = """{ @@ -256,10 +258,10 @@ async def mock_response_text(): "lifecycleDeactivate": { "status": "ENABLED" }, - "profile":{ + "profile": { "status": "ENABLED" }, - "password":{ + "password": { "status": "ENABLED", "seed": "RANDOM", "change": "CHANGE" @@ -313,3 +315,20 @@ async def mock_response_text(): assert mock_http_request.request_info['url'].endswith('/apps/test_app_id/logo') data = mock_http_request.request_info['data'] assert data == {'file': logo} + +class TestOAuthGrantType: + """ + Unit Tests for the OAuthGrantType Enum + """ + + def test_new_enum_types(self): + # List of new ENUM types to be tested + new_enum_types = [ + "urn:okta:params:oauth:grant-type:otp", + "urn:okta:params:oauth:grant-type:oob", + "http://auth0.com/oauth/grant-type/mfa-otp", + "http://auth0.com/oauth/grant-type/mfa-oob" + ] + + for enum_type in new_enum_types: + assert enum_type in models.OAuthGrantType.__members__.values()