def test_find_events(self): rle_publisher = ResourceLifecycleEventPublisher(event_repo=self.container.event_repository) rle_publisher.create_and_publish_event(origin='Some_Resource_Agent_ID1', description="RLE test event1") rle_publisher.create_and_publish_event(origin='Some_Resource_Agent_ID1', description="RLE test event2") de_publisher = DataEventPublisher(event_repo=self.container.event_repository) de_publisher.create_and_publish_event(origin='Some_Resource_Agent_ID2', description="DE test event1") de_publisher.create_and_publish_event(origin='Some_Resource_Agent_ID2', description="DE test event2") events = self.unsc.find_events(origin='Some_Resource_Agent_ID1') for event in events: log.debug("event=" + str(event)) events = self.unsc.find_events(type='DataEvent') for event in events: log.debug("event=" + str(event))
def test_send_notification_emails(self): user_identty_object = IonObject(RT.UserIdentity, name="user1") user_id = self.imc.create_user_identity(user_identty_object) user_info_object = IonObject(RT.UserInfo, {"name":"user1_info", "contact":{"email":'*****@*****.**'}}) self.imc.create_user_info(user_id, user_info_object) notification_object = IonObject(RT.NotificationRequest, {"name":"notification1", "origin_list":['Some_Resource_Agent_ID1'], "events_list":['resource_lifecycle']}) self.unsc.create_notification(notification_object, user_id) notification_object = IonObject(RT.NotificationRequest, {"name":"notification2", "origin_list":['Some_Resource_Agent_ID2'], "events_list":['data']}) self.unsc.create_notification(notification_object, user_id) rle_publisher = ResourceLifecycleEventPublisher() rle_publisher.create_and_publish_event(origin='Some_Resource_Agent_ID1', description="RLE test event") de_publisher = DataEventPublisher() de_publisher.create_and_publish_event(origin='Some_Resource_Agent_ID2', description="DE test event") gevent.sleep(1)