def test_event_list(self): defaults = { "details": "", "date": 0, "vegetarian": False } for i, data in enumerate([{ "title": "Foo", "slots": 1 }, { "title": "Bar", "slots": 2, "vegetarian": True }, { "title": "Baz", "slots": 3 }]): _data = {} _data.update(defaults) _data.update(data) database.create_event(self.db, _data) events = database.list_events(self.db) assert len(events) == 3 assert ["Baz", "Bar", "Foo"] == [event["title"] for event in events]
def test_creation(self): data = { "title": "FooBar", "details": "", "date": "2012:03:10", "slots": 3, "vegetarian": True } assert database.create_event(self.db, data) == 1