コード例 #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
     """
     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
コード例 #2
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
     """
     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
コード例 #3
0
 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')
コード例 #4
0
 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'*****@*****.**')
コード例 #5
0
 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')
コード例 #6
0
 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)
コード例 #7
0
 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)
コード例 #8
0
 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)
コード例 #9
0
 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)
コード例 #10
0
    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)
コード例 #11
0
 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)
コード例 #12
0
 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)
コード例 #13
0
 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)
コード例 #14
0
 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)
コード例 #15
0
 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)
コード例 #16
0
    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)
コード例 #17
0
    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)
コード例 #18
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():
         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)
コード例 #19
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():
         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)
コード例 #20
0
 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
コード例 #21
0
 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)
コード例 #22
0
 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='*****@*****.**')
コード例 #23
0
 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='*****@*****.**')
コード例 #24
0
 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
コード例 #25
0
 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)
コード例 #26
0
 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)