def test_application_with_infrastructure(self): with self.construct_concrete_application() as app: # Start with a new table. app.drop_table() app.drop_table() app.setup_table() app.setup_table() # Check the notifications. reader = NotificationLogReader(app.notification_log) old_notifications = reader.list_notifications() len_old = len(old_notifications) # Check the application's persistence policy, # repository, and event store, are working. aggregate = ExampleAggregateRoot.__create__() aggregate.__save__() self.assertTrue(aggregate.id in app.repository) # Check the notifications. reader = NotificationLogReader(app.notification_log) notifications = reader.list_notifications() self.assertEqual(1 + len_old, len(notifications)) topic = "eventsourcing.tests.core_tests.test_aggregate_root#ExampleAggregateRoot.Created" self.assertEqual(topic, notifications[len_old]["topic"]) app.drop_table()
def test(self): with self.get_application() as app: # Start with a new table. app.drop_table() app.drop_table() app.setup_table() app.setup_table() # Check the application's persistence policy, # repository, and event store, are working. aggregate = ExampleAggregateRoot.__create__() aggregate.__save__() self.assertTrue(aggregate.id in app.repository) # Check the notifications. reader = NotificationLogReader(app.notification_log) notifications = reader.read() self.assertEqual(1, len(notifications)) topic = 'eventsourcing.tests.core_tests.test_aggregate_root#ExampleAggregateRoot.Created' self.assertEqual(topic, notifications[0]['topic']) app.drop_table()