def test_update_empty_values(self, user_mgt_app): recorder = _instrument_provider_mgt(user_mgt_app, 200, OIDC_PROVIDER_CONFIG_RESPONSE) provider_config = auth.update_oidc_provider_config( 'oidc.provider', display_name=auth.DELETE_ATTRIBUTE, enabled=False, app=user_mgt_app) self._assert_provider_config(provider_config) assert len(recorder) == 1 req = recorder[0] assert req.method == 'PATCH' mask = ['displayName', 'enabled'] assert req.url == '{0}/oauthIdpConfigs/oidc.provider?updateMask={1}'.format( USER_MGT_URLS['PREFIX'], ','.join(mask)) got = json.loads(req.body.decode()) assert got == {'displayName': None, 'enabled': False}
def test_update(self, user_mgt_app): recorder = _instrument_provider_mgt(user_mgt_app, 200, OIDC_PROVIDER_CONFIG_RESPONSE) provider_config = auth.update_oidc_provider_config( **self.VALID_CREATE_OPTIONS, app=user_mgt_app) self._assert_provider_config(provider_config) assert len(recorder) == 1 req = recorder[0] assert req.method == 'PATCH' mask = ['clientId', 'displayName', 'enabled', 'issuer'] assert req.url == '{0}/oauthIdpConfigs/oidc.provider?updateMask={1}'.format( USER_MGT_URLS['PREFIX'], ','.join(mask)) got = json.loads(req.body.decode()) assert got == self.OIDC_CONFIG_REQUEST
def test_update_oidc_provider_config(): provider_config = _create_oidc_provider_config() try: provider_config = auth.update_oidc_provider_config( provider_config.provider_id, client_id='UPDATED_OIDC_CLIENT_ID', issuer='https://oidc.com/updated_issuer', display_name='UPDATED_OIDC_DISPLAY_NAME', enabled=False, client_secret='CLIENT_SECRET', id_token_response_type=False, code_response_type=True) assert provider_config.client_id == 'UPDATED_OIDC_CLIENT_ID' assert provider_config.issuer == 'https://oidc.com/updated_issuer' assert provider_config.display_name == 'UPDATED_OIDC_DISPLAY_NAME' assert provider_config.enabled is False assert provider_config.id_token_response_type is False assert provider_config.code_response_type is True assert provider_config.client_secret == 'CLIENT_SECRET' finally: auth.delete_oidc_provider_config(provider_config.provider_id)
def test_update_invalid_args(self, user_mgt_app, invalid_opts): options = {'provider_id': 'oidc.provider'} options.update(invalid_opts) with pytest.raises(ValueError): auth.update_oidc_provider_config(**options, app=user_mgt_app)