コード例 #1
0
    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            event = Event(name="event1",
                          start_time=datetime(2013, 8, 4, 12, 30, 45),
                          end_time=datetime(2016, 9, 4, 12, 30, 45))
            event.owner = 1
            save_to_db(event, "Event saved")

            self.event_form = EventForm()
            self.session_form = SessionForm()
コード例 #2
0
def create_event(name='TestEvent', creator_email=None):
    """Creates Event and returns its `id`.
    :param name Name of Event
    """
    event = Event(name=name,
                  start_time=datetime(2016, 4, 8, 12, 30, 45),
                  end_time=datetime(2016, 4, 9, 12, 30, 45))
    if creator_email:
        event.creator = User.query.filter_by(email=creator_email).first()
    save_to_db(event, 'Event saved')
    return event.id
コード例 #3
0
 def test_api_tracks(self):
     with self.assertRaises(Exception) as context:
         self.app.get('/api/v1/event/1')
     self.assertTrue(AttributeError, context.exception)
     ev = Event(name="event1",
                start_time=datetime.datetime(2003, 8, 4, 12, 30, 45),
                end_time=datetime.datetime(2003, 8, 4, 12, 30, 45))
     tr = Track(name="name", event_id=1, description="description")
     with app.test_request_context():
         db.session.add(ev)
         db.session.add(tr)
         db.session.commit()
     self.assertEqual(self.app.get('/api/v1/event/1').status_code, 200)
     self.assertEqual(
         self.app.get('/api/v1/event/1/tracks').status_code, 200)
コード例 #4
0
    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            event = Event(name=UNICODE_STRING,
                          start_time=datetime(2013, 8, 4, 12, 30, 45),
                          end_time=datetime(2016, 9, 4, 12, 30, 45))
            event.owner = 1

            microlocation = Microlocation(name=UNICODE_STRING)
            session = Session(title=UNICODE_STRING,
                              long_abstract='descp',
                              start_time=datetime(2014, 8, 4, 12, 30, 45),
                              end_time=datetime(2015, 9, 4, 12, 30, 45))
            speaker = Speaker(name=UNICODE_STRING,
                              email='*****@*****.**',
                              organisation='org',
                              country='japan')
            sponsor = Sponsor(name=UNICODE_STRING)

            save_to_db(event, "Event saved")
            save_to_db(microlocation, 'Microlocation saved')
            save_to_db(session, 'Session saved')
            save_to_db(speaker, 'Speaker saved')
            save_to_db(sponsor, 'Sponsor saved')
コード例 #5
0
 def get_event():
     return Event(name="event1",
                  start_time=datetime(2003, 8, 4, 12, 30, 45),
                  end_time=datetime(2003, 9, 4, 12, 30, 45))