def test_admin_dashboard_attempt(self): with app.test_request_context(): logout(self.app) register(self.app, "*****@*****.**", "SomeRandomPassword") login(self.app, "*****@*****.**", "SomeRandomPassword") rv = self.app.get(url_for('sadmin.index_view'), follow_redirects=True) self.assertEqual(rv.status_code, 403)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') logout(self.app) event_id = create_event(name='TestEvent_1', creator_email=u'*****@*****.**') create_services(event_id)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') logout(self.app) event_id = create_event( name='TestEvent_1', creator_email=u'*****@*****.**') create_services(event_id)
def test_admin_dashboard_attempt(self): with app.test_request_context(): logout(self.app) register(self.app, "*****@*****.**", "SomeRandomPassword") login(self.app, "*****@*****.**", "SomeRandomPassword") rv = self.app.get(url_for('sadmin.index_view'), follow_redirects=True) self.assertEqual(rv.status_code, 403)
def test_speaker_api(self): path = get_path(1, 'speakers', 1) # logged in and check self._test_path(path, 'TestSpeaker_1', 'email', 'mobile') # logged out, private fields not present logout(self.app) resp = self.app.get(path) self.assertNotIn('email', resp.data) self.assertNotIn('mobile', resp.data)
def test_speaker_api(self): path = get_path(1, 'speakers', 1) # logged in and check self._test_path(path, 'TestSpeaker_1', 'email', 'mobile') # logged out, private fields not present logout(self.app) resp = self.app.get(path) self.assertNotIn('email', resp.data) self.assertNotIn('mobile', resp.data)
def test_user_already_logged_in(self): """If the user is already logged in then on clicking 'Login with Facebook' he should be redirected directly to the admin page""" with app.test_request_context(): register(self.app, '*****@*****.**', 'test') logout(self.app) login(self.app, '*****@*****.**', 'test') self.assertTrue('Open Event' in self.app.get('/fCallback/?code=dummy_code&state=dummy_state', follow_redirects=True).data) self.assertEqual(self.app.get('/fCallback/?code=dummy_code&state=dummy_state').status_code, 302)
def test_user_already_logged_in(self): """If the user is already logged in then on clicking 'Login with Google' he should be redirected directly to the admin page""" with app.test_request_context(): register(self.app, '*****@*****.**', 'test') logout(self.app) login(self.app, '*****@*****.**', 'test') self.assertTrue('Open Event' in self.app.get('/gCallback/?state=dummy_state&code=dummy_code', follow_redirects=True).data) self.assertEqual(self.app.get('/gCallback/?state=dummy_state&code=dummy_code').status_code, 302)
def test_user_already_logged_in(self): """If the user is already logged in then on clicking 'Login with Google' he should be redirected directly to the admin page""" with app.test_request_context(): register(self.app, '*****@*****.**', 'test') logout(self.app) login(self.app, '*****@*****.**', 'test') with HTTMock(google_auth_mock, google_profile_mock): self.assertTrue('Open Event' in self.app.get('/gCallback/?state=dummy_state&code=dummy_code', follow_redirects=True).data) self.assertEqual(self.app.get('/gCallback/?state=dummy_state&code=dummy_code').status_code, 302)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') create_event(creator_email=u'*****@*****.**') logout(self.app)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, '*****@*****.**', 'test') logout(self.app) update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, '*****@*****.**', 'test') logout(self.app) update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1)
def test_logout(self): with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') login(self.app, '*****@*****.**', 'test') rv = logout(self.app) self.assertTrue("Login" in rv.data)
def test_incorrect_login(self): with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') logout(self.app) rv = login(self.app, '*****@*****.**', 'other_test') self.assertTrue("Login Form" in rv.data)
def test_correct_login(self): with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') logout(self.app) rv = login(self.app, '*****@*****.**', 'test') self.assertTrue("Open Event" in rv.data, msg=rv.data)