def create_dummy_client(user): db_oauth_client.create( user_id=user.id, name="Dummy Client", desc="Created for testing the webservice", website="http://example.com/", redirect_uri="http://example.com/redirect/", ) client = db_users.clients(user.id)[0] return client
def create_dummy_client(user): db_oauth_client.create( user_id=user.id, name="Dummy Client", desc="Created for testing the webservice", website="http://example.com/", redirect_uri="http://example.com/redirect/", ) client = db_users.clients(user.id)[0] return client
def test_user_clients(self): db_oauth_client.create( user_id=self.user1.id, name="Some Application", desc="Created for some purpose", website="https://example.com", redirect_uri="https://example.com/redirect/", ) client = db_users.clients(self.user1.id)[0] self.assertEqual(client["name"], "Some Application") self.assertEqual(client["website"], "https://example.com")
def test_user_clients(self): db_oauth_client.create( user_id=self.user1.id, name="Some Application", desc="Created for some purpose", website="https://example.com", redirect_uri="https://example.com/redirect/", ) client = db_users.clients(self.user1.id)[0] self.assertEqual(client["name"], "Some Application") self.assertEqual(client["website"], "https://example.com")
def setUp(self): super(OAuthGrantTestCase, self).setUp() self.user = User(db_users.get_or_create(1, 'tester_1', new_user_data={ "display_name": "test", })) db_oauth_client.create( user_id=self.user.id, name="Test App", desc="Application for testing", website="https://example.com", redirect_uri="https://example.com/oauth", ) self.oauth_client = db_users.clients(self.user.id)[0]
def setUp(self): super(OAuthTokenTestCase, self).setUp() self.user = User(db_users.get_or_create(1, 'tester_1', new_user_data={ "display_name": "test", })) db_oauth_client.create( user_id=self.user.id, name="Test App", desc="Application for testing", website="https://example.com", redirect_uri="https://example.com/oauth", ) self.oauth_client = db_users.clients(self.user.id)[0]
def create(): """Create application.""" form = ApplicationForm() if form.validate_on_submit(): db_oauth_client.create( user_id=current_user.id, name=form.name.data, desc=form.desc.data, website=form.website.data, redirect_uri=form.redirect_uri.data, ) flash.success(gettext('You have created an application!')) return redirect(url_for('.index')) return render_template('profile/applications/create.html', form=form)
def test_user_tests(self): db_oauth_client.create( user_id=self.user1.id, name="Some Application", desc="Created for some purpose", website="https://example.com", redirect_uri="https://example.com/redirect/", ) client = db_users.clients(self.user1.id)[0] db_oauth_token.create( client_id=client["client_id"], access_token="Test Access Token", refresh_token="Test Refresh Token", expires=datetime.now() + timedelta(seconds=200), user_id=self.user1.id, scopes=None, ) tokens = db_users.tokens(self.user1.id) self.assertEqual(tokens[0]["client_name"], "Some Application") self.assertEqual(tokens[0]["refresh_token"], "Test Refresh Token")
def test_user_tests(self): db_oauth_client.create( user_id=self.user1.id, name="Some Application", desc="Created for some purpose", website="https://example.com", redirect_uri="https://example.com/redirect/", ) client = db_users.clients(self.user1.id)[0] db_oauth_token.create( client_id=client["client_id"], access_token="Test Access Token", refresh_token="Test Refresh Token", expires=datetime.now() + timedelta(seconds=200), user_id=self.user1.id, scopes=None, ) tokens = db_users.tokens(self.user1.id) self.assertEqual(tokens[0]["client_name"], "Some Application") self.assertEqual(tokens[0]["refresh_token"], "Test Refresh Token")
def create_dummy_application(self): db_oauth_client.create(user_id=self.user.id, **self.application) client = db_users.clients(self.user.id)[0] return client
def create_dummy_application(self): db_oauth_client.create(user_id=self.user.id, **self.application) client = db_users.clients(self.user.id)[0] return client