def setUp(self): self.app = Setup.create_app() with app.test_request_context(): # `event_id` is going to be 1 event_id = create_event() # 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') update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1) event_id = create_event(creator_email='*****@*****.**') create_services(event_id)
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 """ 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'], '')
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 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(): # `event_id` is going to be 1 event_id = create_event() # 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(): # `event_id` is going to be 1 event_id = create_event() # Associate services to event_id=2 # No need to create the event though create_services(event_id + 1)
def test_export_success(self): resp = self._do_successful_export(1) self.assertIn('event1.zip', resp.headers['Content-Disposition']) size = len(resp.data) with app.test_request_context(): create_services(1, '2') create_services(1, '3') # check if size increased resp = self._do_successful_export(1) self.assertEqual(resp.status_code, 200) self.assertTrue(len(resp.data) > size)
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(): # Create two instances of event/services # event_id is going to be 1 event_id1 = create_event('TestEvent_1') # event_id is going to be 2 create_event('TestEvent_2') # Associate services to event_id1 create_services(event_id1, serial_no=1) create_services(event_id1, serial_no=2)
def test_export_success(self): path = get_path(1, 'export', 'json') resp = self.app.get(path) self.assertEqual(resp.status_code, 200) self.assertIn('event1.zip', resp.headers['Content-Disposition']) size = len(resp.data) with app.test_request_context(): create_services(1, '2') create_services(1, '3') # check if size increased resp = self.app.get(path) self.assertEqual(resp.status_code, 200) self.assertTrue(len(resp.data) > size)
def _test_model(self, name): """ Tests the 404 response, then add item and test the success response """ path = get_path(1, name + 's', 'page') response = self.app.get(path, follow_redirects=True) # check for 404 in no data self.assertEqual(response.status_code, 404) # add single data with app.test_request_context(): create_services(1) response = self.app.get(path, follow_redirects=True) self.assertEqual(response.status_code, 200) self.assertIn('Test' + str(name).title(), response.data)
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') 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(): event_id = create_event(name='TestEvent_1') create_services(event_id)
def setUp(self): self.app = Setup.create_app() with app.test_request_context(): create_event() create_services(1)