def test_provide_correct_redirect_url(self): env_overrides = dict(HTTP_REFERER='http_referer') with app.test_request_context(environ_overrides=env_overrides): self.assertTrue(url_next().endswith('http_referer')) with app.test_request_context('/?next=url_next'): self.assertTrue(url_next().endswith('url_next')) with app.test_request_context(): self.assertIsNone(url_next())
def test_login_via_github(self): with app.test_request_context(): resp = oauth_login() self.assertTrue(resp.headers['Location'].endswith('authorized')) self.assertEquals(resp.status_code, 302)
def test_login_via_github(self): with app.test_request_context(): resp = login() self.assertTrue(resp.headers['Location'].endswith('authorized')) self.assertEqual(resp.status_code, 302)