Exemplo n.º 1
0
 def setUp(self):
     self.testapp = TestApp(main(
         {},
         **{
             'sqlalchemy.url': os.environ.get('DB', 'sqlite://'),
             'secret.authn_policy':'so_secret',
             'secret.unencrypted_cookie':'itsaseekreet',
             'mako.directories':'pyconca:templates',
         }
     ))
     Base.metadata.drop_all(DBSession.bind)
     Base.metadata.create_all(DBSession.bind)
     with transaction.manager:
         self._admin_id = 1
         self._speaker_id = 2
         self._admin_talk_id = 11
         self._speaker_talk_id = 12
         self._schedule_slot_id = 21
         admin = User(id=self._admin_id, username='******', password='******', first_name='Admin', last_name='Istrator', email='*****@*****.**')
         speaker = User(id=self._speaker_id, username='******', password='******', first_name='Spe', last_name='Aker', email='*****@*****.**')
         admin_group = Group(name='admin')
         admin.groups.append(admin_group)
         admin_talk = Talk(id=self._admin_talk_id, owner_id=self._admin_id, title="atitle", type="talk", level="novice", abstract="aabstract", outline="aoutline", reviewer_notes="areviewer_notes")
         speaker_talk = Talk(id=self._speaker_talk_id, owner_id=self._speaker_id, title="stitle", type="tutorial", level="experienced", abstract="sabstract", outline="soutline", reviewer_notes="sreviewer_notes")
         start = datetime(2012, 11, 10, 15, 00)
         end = datetime(2012,11,10,15,30)
         schedule_slot = ScheduleSlot(id=self._schedule_slot_id, room="room", start=start, end=end, code="X%s" %(self._schedule_slot_id, ))
         DBSession.add_all([admin, speaker, admin_group, admin_talk, speaker_talk, schedule_slot])
Exemplo n.º 2
0
 def setUp(self):
     self.testapp = TestApp(main(
         {},
         **{
             'sqlalchemy.url': os.environ.get('DB', 'sqlite://'),
             'secret.authn_policy':'so_secret',
             'secret.unencrypted_cookie':'itsaseekreet',
             'mako.directories':'pyconca:templates',
         }
     ))
     Base.metadata.drop_all(DBSession.bind)
     Base.metadata.create_all(DBSession.bind)
     with transaction.manager:
         self._admin_id = 1
         self._speaker_id = 2
         self._admin_talk_id = 11
         self._speaker_talk_id = 12
         self._schedule_slot_id = 21
         admin = User(id=self._admin_id, username='******', password='******', first_name='Admin', last_name='Istrator', email='*****@*****.**')
         speaker = User(id=self._speaker_id, username='******', password='******', first_name='Spe', last_name='Aker', email='*****@*****.**')
         admin_group = Group(name='admin')
         admin.groups.append(admin_group)
         admin_talk = Talk(id=self._admin_talk_id, owner_id=self._admin_id, title="atitle", type="talk", level="novice", abstract="aabstract", outline="aoutline", reviewer_notes="areviewer_notes")
         speaker_talk = Talk(id=self._speaker_talk_id, owner_id=self._speaker_id, title="stitle", type="tutorial", level="experienced", abstract="sabstract", outline="soutline", reviewer_notes="sreviewer_notes")
         start = datetime(2012, 11, 10, 15, 00)
         end = datetime(2012,11,10,15,30)
         schedule_slot = ScheduleSlot(id=self._schedule_slot_id, room="room", start=start, end=end)
         DBSession.add_all([admin, speaker, admin_group, admin_talk, speaker_talk, schedule_slot])
Exemplo n.º 3
0
 def test_talk_api_talk_is_scheduled(self):
     with transaction.manager:
         talk = DBSession.query(Talk).get(self._admin_talk_id)
         schedule_slot = DBSession.query(ScheduleSlot).get(self._schedule_slot_id)
         schedule_slot.talk = talk
     data = self._getJsonFrom('/talk/11.json', who='admin', status=200)
     self.assertEquals("room", data['data']['talk']['room'])
     self.assertEquals("2012-11-10T10:00:00-05:00", data['data']['talk']['start'])
     self.assertEquals("2012-11-10T10:30:00-05:00", data['data']['talk']['end'])
     self.assertEquals(30, data['data']['talk']['duration'])
     self.assertEquals("X21", data['data']['talk']['schedule_code'])
Exemplo n.º 4
0
 def test_talk_api_talk_is_scheduled(self):
     start = datetime(2012, 11, 10, 15, 00)
     end = datetime(2012,11,10,15,30)
     with transaction.manager:
         talk = DBSession.query(Talk).get(self._admin_talk_id)
         slot = ScheduleSlot(id=101, room="room", start=start, end=end, talk=talk)
         DBSession.add(slot)
     data = self._getJsonFrom('/talk/11.json', who='admin', status=200)
     self.assertEquals("room", data['data']['talk']['room'])
     self.assertEquals("2012-11-10T10:00:00-05:00", data['data']['talk']['start'])
     self.assertEquals("2012-11-10T10:30:00-05:00", data['data']['talk']['end'])
     self.assertEquals(30, data['data']['talk']['duration'])
Exemplo n.º 5
0
 def test_talk_api_talk_is_scheduled(self):
     start = datetime(2012, 11, 10, 15, 00)
     end = datetime(2012,11,10,15,30)
     with transaction.manager:
         talk = DBSession.query(Talk).get(self._admin_talk_id)
         schedule_slot = DBSession.query(ScheduleSlot).get(self._schedule_slot_id)
         schedule_slot.talk = talk
     data = self._getJsonFrom('/talk/11.json', who='admin', status=200)
     self.assertEquals("room", data['data']['talk']['room'])
     self.assertEquals("2012-11-10T10:00:00-05:00", data['data']['talk']['start'])
     self.assertEquals("2012-11-10T10:30:00-05:00", data['data']['talk']['end'])
     self.assertEquals(30, data['data']['talk']['duration'])
Exemplo n.º 6
0
 def tearDown(self):
     DBSession.remove()
Exemplo n.º 7
0
 def tearDown(self):
     DBSession.remove()