Lines Matching refs:oauth2
74 self.oauth2 = flask_util.UserOAuth2(
95 oauth2 = flask_util.UserOAuth2(
98 self.assertEqual(oauth2.client_id, 'id')
99 self.assertEqual(oauth2.client_secret, 'secret')
108 oauth2 = flask_util.UserOAuth2(
111 self.assertEqual(oauth2.client_id, 'id')
112 self.assertEqual(oauth2.client_secret, 'secret')
116 oauth2 = flask_util.UserOAuth2()
117 oauth2.init_app(app, client_id='id', client_secret='secret')
118 self.assertEqual(oauth2.app, app)
122 oauth2 = flask_util.UserOAuth2(
125 self.assertEqual(oauth2.storage, storage_mock)
128 oauth2 = flask_util.UserOAuth2(
131 self.assertEqual(oauth2.scopes, ['1', '2'])
149 oauth2 = flask_util.UserOAuth2(app)
151 self.assertEqual(oauth2.client_id, 'id')
152 self.assertEqual(oauth2.client_secret, 'secret')
163 oauth2 = flask_util.UserOAuth2(app)
165 self.assertEqual(oauth2.client_id, 'id2')
166 self.assertEqual(oauth2.client_secret, 'secret2')
174 flow = self.oauth2._make_flow()
179 self.assertEqual(flow.client_id, self.oauth2.client_id)
180 self.assertEqual(flow.client_secret, self.oauth2.client_secret)
184 flow = self.oauth2._make_flow(return_url='/return_url')
188 flow = self.oauth2._make_flow(extra_arg='test')
194 oauth2 = flask_util.UserOAuth2(
199 flow = oauth2._make_flow()
210 self.assertNotIn(self.oauth2.client_secret, location)
211 self.assertIn(self.oauth2.client_id, q['client_id'])
234 self.oauth2._make_flow(return_url='/return_url')
236 self.oauth2._make_flow(**kwargs)
247 self.oauth2.storage = mock.Mock()
257 self.assertIn(self.oauth2.client_secret, http.body)
259 self.assertTrue(self.oauth2.storage.put.called)
262 self.oauth2.authorize_callback = mock.Mock()
264 self.assertTrue(self.oauth2.authorize_callback.called)
330 self.assertFalse(self.oauth2.has_credentials())
331 self.assertTrue(self.oauth2.credentials is None)
332 self.assertTrue(self.oauth2.user_id is None)
333 self.assertTrue(self.oauth2.email is None)
335 self.oauth2.http()
336 self.assertFalse(self.oauth2.storage.get())
337 self.oauth2.storage.delete()
342 self.oauth2.storage.put(credentials)
344 self.oauth2.credentials.access_token, credentials.access_token)
346 self.oauth2.credentials.refresh_token,
348 self.assertEqual(self.oauth2.user_id, '123')
349 self.assertEqual(self.oauth2.email, 'user@example.com')
350 self.assertTrue(self.oauth2.http())
361 self.oauth2.storage.put(credentials)
362 self.assertTrue(self.oauth2.has_credentials())
367 self.oauth2.storage.put(credentials)
368 self.assertFalse(self.oauth2.has_credentials())
374 self.oauth2.storage.put(credentials)
375 self.assertTrue(self.oauth2.user_id is None)
376 self.assertTrue(self.oauth2.email is None)
380 @self.oauth2.required
391 credentials = self._generate_credentials(scopes=self.oauth2.scopes)
435 self.oauth2 = flask_util.UserOAuth2(
442 @self.oauth2.required(scopes=['one'])
447 @self.oauth2.required(scopes=['two', 'three'])
510 credentials = self.oauth2.credentials
517 self.oauth2.storage.put(self._generate_credentials())
519 self.oauth2.credentials.refresh(
523 self.oauth2.storage.get().access_token, 'new_token')
528 self.oauth2.storage.put(self._generate_credentials())
529 self.oauth2.storage.delete()