def test_create_missing_clientid(self): """ Creation with missing --client-id""" idp_with_provider = IdpTracker('idp_with_provider', ipaidptokenendpoint=google_token, ipaidpdevauthendpoint=google_devauth, ipaidpauthendpoint=google_auth) idp_with_provider.track_create() command = idp_with_provider.make_create_command() with raises_exact(errors.RequirementError(name='client_id')): command()
def test_create_missing_authendpoint(self): """ Creation with missing --dev-auth-uri and --auth-uri""" idp_with_provider = IdpTracker('idp_with_provider', ipaidptokenendpoint=google_token, ipaidpclientid="idpclient1") idp_with_provider.track_create() command = idp_with_provider.make_create_command() with raises_exact( errors.RequirementError(name='dev-auth-uri or provider')): command()
def renamedidp(request, xmlrpc_setup): tracker = IdpTracker('idp2', ipaidpauthendpoint=google_auth, ipaidpdevauthendpoint=google_devauth, ipaidptokenendpoint=google_token, ipaidpuserinfoendpoint=google_userinfo, ipaidpkeysendpoint=google_jwks, ipaidpclientid="idp1client", ipaidpclientsecret="Secret123", ipaidpscope=idp_scope) return tracker.make_fixture(request)
def test_create_with_invalid_provider(self): """ Creation with invalid --provider parameter """ idp_with_provider = IdpTracker('idp_with_provider', ipaidpprovider='fake', ipaidpclientid="idpclient1") idp_with_provider.track_create() command = idp_with_provider.make_create_command() with raises_exact( errors.ValidationError( name='provider', error="must be one of 'google', 'github', 'microsoft', " "'okta', 'keycloak'")): command()
def test_create_with_provider_and_tokenendpoint(self): """ Creation with --provider parameter and --token-uri""" idp_with_provider = IdpTracker('idp_with_provider', ipaidpprovider='google', ipaidptokenendpoint=google_token, ipaidpdevauthendpoint=google_devauth, ipaidpclientid="idpclient1") idp_with_provider.track_create() command = idp_with_provider.make_create_command() with raises_exact( errors.MutuallyExclusiveError( reason= 'cannot specify both individual endpoints and IdP provider' )): command()
def test_create_idp_with_min_values(self): """ Creation with only mandatory parameters """ idp_min = IdpTracker('min_idp', ipaidpauthendpoint=google_auth, ipaidpdevauthendpoint=google_devauth, ipaidptokenendpoint=google_token, ipaidpuserinfoendpoint=google_userinfo, ipaidpkeysendpoint=google_jwks, ipaidpclientid="idp1client") idp_min.track_create() command = idp_min.make_create_command() result = command() idp_min.check_create(result) idp_min.delete()
def test_create_idp_with_provider(self): """ Creation with --provider parameter """ idp_with_provider = IdpTracker('idp_with_provider', ipaidpprovider='google', ipaidpclientid="idpclient1") idp_with_provider.track_create() # the endpoints are automatically added idp_with_provider.attrs.update(ipaidpauthendpoint=[google_auth]) idp_with_provider.attrs.update(ipaidpdevauthendpoint=[google_devauth]) idp_with_provider.attrs.update(ipaidptokenendpoint=[google_token]) idp_with_provider.attrs.update(ipaidpkeysendpoint=[google_jwks]) idp_with_provider.attrs.update( ipaidpuserinfoendpoint=[google_userinfo]) idp_with_provider.attrs.update(ipaidpscope=[idp_scope]) idp_with_provider.attrs.update(ipaidpsub=[idp_sub]) command = idp_with_provider.make_create_command() result = command() idp_with_provider.check_create(result) idp_with_provider.delete()