def test_create_two_non_unique_events(self): with self.app.test_request_context(): DB.create_all() person = Person.create( name="John Doe", username="******", email="*****@*****.**", website="http://johnd.com", password="******", ) DB.session.add(person) event = Event.create( title="Event 1", description="This is Event 1", speaker="By the Event 1 speaker", location="In the Event Room", editor=person, edited_datetime=datetime.datetime.today(), start=datetime.datetime(2000, 1, 2), end=datetime.datetime(2000, 1, 3), canceled=False, hidden=False, list=0, index=0, ) DB.session.add(event) event = Event.create( title="Event 1", description="This is Event 1", speaker="By the Event 1 speaker", location="In the Event Room", editor=person, edited_datetime=datetime.datetime.today(), start=datetime.datetime(2000, 1, 2), end=datetime.datetime(2000, 1, 3), canceled=False, hidden=False, list=0, index=0, ) DB.session.add(event) try: DB.session.commit() except Exception: pass else: raise Exception("IntegrityError excepted but not thrown")
def test_create_event_with_null_person(self): with self.app.test_request_context(): DB.create_all() event = Event.create( title="Event 1", description="This is Event 1", speaker="By the Event 1 speaker", location="In the Event Room", editor=None, edited_datetime=datetime.datetime.today(), start=datetime.datetime.today(), end=datetime.datetime.today(), canceled=False, hidden=False, list=0, index=0, ) DB.session.add(event) try: DB.session.commit() except Exception: pass else: raise Exception("IntegrityError excepted but not thrown")
def test_create_event_with_start_before_end(self): with self.app.test_request_context(): DB.create_all() person = Person.create( name="John Doe", username="******", email="*****@*****.**", website="http://johnd.com", password="******", ) event = Event.create( title="Event 1", description="This is Event 1", speaker="By the Event 1 speaker", location="In the Event Room", editor=person, edited_datetime=datetime.datetime.today(), start=datetime.datetime(2000, 1, 2), end=datetime.datetime(2000, 1, 3), canceled=False, hidden=False, list=0, index=0, ) DB.session.add(person) DB.session.add(event) DB.session.commit() DB.session.delete(event) DB.session.commit()