def _test_model(self, name): """ Tests - 1. When just one item, check if next and prev urls are empty 2. When one more item added, limit results to 1 and see if next is not empty 3. start from position 2 and see if prev is not empty """ login(self.app, u'*****@*****.**', u'test') if name == 'event': path = get_path('page') else: path = get_path(1, name + 's', 'page') data = self._json_from_url(path) self.assertEqual(data['next'], '') self.assertEqual(data['previous'], '') # add second service with app.test_request_context(): create_event(name='TestEvent2') create_services(1) data = self._json_from_url(path + '?limit=1') self.assertIn('start=2', data['next']) self.assertEqual(data['previous'], '') # check from start=2 data = self._json_from_url(path + '?start=2') self.assertIn('limit=1', data['previous']) self.assertEqual(data['next'], '') self.assertIn('http', data['previous']) # check absolute link
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): """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='*****@*****.**', 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_api(self): login(self.app, u'*****@*****.**', u'test') path = get_path('page') response = self.app.get(path) self.assertEqual(response.status_code, 404, msg=response.data) with app.test_request_context(): create_event() response = self.app.get(path) self.assertEqual(response.status_code, 200) self.assertIn('TestEvent', response.data)
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') # 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, 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') 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') # 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): """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') create_event() # no creator_email, no organizer is set
def test_api_filters(self): with app.test_request_context(): create_event(creator_email=u'*****@*****.**') path = get_path('page') + '?location=r@nd0m' resp = self.app.get(path) self.assertEqual(resp.status_code, 404)
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, u'*****@*****.**', u'test') create_event(creator_email=u'*****@*****.**') logout(self.app)