def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1) event_id = create_event(creator_email='*****@*****.**') create_services(event_id)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1) event_id = create_event(creator_email='*****@*****.**') 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 setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # `event_id` is going to be 1 event_id = create_event(creator_email=u'*****@*****.**') # Associate services to event_id create_services(event_id)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') create_event(creator_email='*****@*****.**') create_services(1, '1') create_services(1, '2') create_services(1, '3')
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 setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # `event_id` is going to be 1 event_id = create_event(creator_email=u'*****@*****.**') # Associate services to event_id 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 setUp(self): """Create Event but don't define services for it. """ self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # Created event will have id=1 create_event(creator_email=u'*****@*****.**')
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') create_event(creator_email='*****@*****.**') create_services(1, '1') create_services(1, '2') create_services(1, '3')
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # User must be part of the staff to access listed events update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1) event_id = create_event(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') # User must be part of the staff to access listed events update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1) event_id = create_event(creator_email=u'*****@*****.**') create_services(event_id)
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 setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') create_event( creator_email='*****@*****.**', location_name='Science Centre, Singapore', latitude=87.5, longitude=88.5 ) create_services(1, '1') create_session(1, '2', state='accepted', track=1, microlocation=1, speakers=[1], session_type=1)
def test_event_api(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') login(self.app, u'*****@*****.**', u'test') # Non existing event event_id = 1 path = get_path(event_id) response = self.app.get(path) self.assertEqual(response.status_code, 404) self.assertIn('does not exist', response.data)
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): """Create Event (it will have id = `event_id`). Create services and associate them with event id = `event_id` + 1. """ self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # `event_id` is going to be 1 event_id = create_event(creator_email=u'*****@*****.**') # Associate services to event_id=2 # No need to create the event though create_services(event_id + 1)
def setUp(self): """Create Event (it will have id = `event_id`). Create services and associate them with event id = `event_id` + 1. """ self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # `event_id` is going to be 1 event_id = create_event(creator_email=u'*****@*****.**') # Associate services to event_id=2 # No need to create the event though create_services(event_id+1)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') # User must be part of the staff to access listed events update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1) # Create two instances of event/services # event_id is going to be 1 event_id1 = create_event('TestEvent_1', creator_email=u'*****@*****.**') # event_id is going to be 2 create_event('TestEvent_2', creator_email=u'*****@*****.**') # Associate services to event_id1 create_services(event_id1, serial_no=1) create_services(event_id1, serial_no=2)
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, u'*****@*****.**', u'test') create_event() # no creator_email, no organizer is set
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') create_event() # no creator_email, no organizer is set
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_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)
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 setUp(self): self.app = Setup.create_app() with app.test_request_context(): register(self.app, u'*****@*****.**', u'test') create_event(name='TestEvent0', creator_email='*****@*****.**')
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, u'*****@*****.**', u'test')
def test_registration(self): with app.test_request_context(): rv = register(self.app, u'*****@*****.**', u'test') self.assertTrue("Open Event" in rv.data)
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, u'*****@*****.**', u'test') create_event(name='TestEvent0', creator_email='*****@*****.**')