def test_empty_redirect_uri_and_scope(models_fixture): app = models_fixture with app.app_context(): client = Client(client_id='dev2', client_secret='dev2', name='dev2', description='', is_confidential=False, user=app.test_user, _redirect_uris='', _default_scopes="") with db.session.begin_nested(): db.session.add(client) assert client.default_redirect_uri is None assert client.redirect_uris == [] assert client.default_scopes == [] client.default_scopes = [ 'test:scope1', 'test:scope2', 'test:scope2', ] assert set(client.default_scopes) == set( ['test:scope1', 'test:scope2']) with pytest.raises(ScopeDoesNotExists): client.default_scopes = ['invalid'] with db.session.begin_nested(): db.session.delete(client)
def test_empty_redirect_uri_and_scope(models_fixture): app = models_fixture with app.app_context(): client = Client( client_id='dev2', client_secret='dev2', name='dev2', description='', is_confidential=False, user=app.test_user, _redirect_uris='', _default_scopes="" ) with db.session.begin_nested(): db.session.add(client) assert client.default_redirect_uri is None assert client.redirect_uris == [] assert client.default_scopes == [] client.default_scopes = ['test:scope1', 'test:scope2', 'test:scope2', ] assert set(client.default_scopes) == set( ['test:scope1', 'test:scope2']) with pytest.raises(ScopeDoesNotExists): client.default_scopes = ['invalid'] with db.session.begin_nested(): db.session.delete(client)
def test_empty_redirect_uri_and_scope(self): from invenio_oauth2server.models import Client from invenio_oauth2server.errors import ScopeDoesNotExists c = Client( client_id='dev', client_secret='dev', name='dev', description='', is_confidential=False, user=self.objects[0], _redirect_uris='', _default_scopes="" ) self.create_objects([c]) self.assertIsNone(c.default_redirect_uri) self.assertEqual(c.redirect_uris, []) self.assertEqual(c.default_scopes, []) c.default_scopes = ['test:scope1', 'test:scope2', 'test:scope2', ] self.assertEqual(c.default_scopes, ['test:scope1', 'test:scope2']) self.assertRaises(ScopeDoesNotExists, c.__setattr__, 'default_scopes', ['invalid', ]) self.delete_objects([c])
def test_empty_redirect_uri_and_scope(self): from invenio_oauth2server.models import Client from invenio_oauth2server.errors import ScopeDoesNotExists c = Client(client_id='dev', client_secret='dev', name='dev', description='', is_confidential=False, user=self.objects[0], _redirect_uris='', _default_scopes="") self.create_objects([c]) self.assertIsNone(c.default_redirect_uri) self.assertEqual(c.redirect_uris, []) self.assertEqual(c.default_scopes, []) c.default_scopes = [ 'test:scope1', 'test:scope2', 'test:scope2', ] self.assertEqual(c.default_scopes, ['test:scope1', 'test:scope2']) self.assertRaises(ScopeDoesNotExists, c.__setattr__, 'default_scopes', [ 'invalid', ]) self.delete_objects([c])