Esempio n. 1
0
 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'], '')
Esempio n. 2
0
 def setUp(self):
     """Create Event but don't define services for it.
     """
     self.app = Setup.create_app()
     with app.test_request_context():
         # Created event will have id=1
         create_event()
 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'*****@*****.**')
Esempio n. 5
0
 def test_api(self):
     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)
Esempio n. 6
0
    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 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 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 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)
Esempio n. 11
0
 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')
         # `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):
     """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)
Esempio n. 15
0
 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():
         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')
         logout(self.app)
         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=u'*****@*****.**')
 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():
         create_event()
 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         event_id = create_event(name='TestEvent_1')
         create_services(event_id)
Esempio n. 22
0
 def test_api_filters(self):
     with app.test_request_context():
         create_event()
     path = get_path('page') + '?location_name=r@nd0m'
     resp = self.app.get(path)
     self.assertEqual(resp.status_code, 404)
Esempio n. 23
0
 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'*****@*****.**', u'test')
         create_event()
 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         create_event()
         create_services(1)
 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='*****@*****.**')