def test_get_subscribers(self): with self.app.app_context(): resolved_destination_groups = archive_publish.ArchivePublishService( ).resolve_destination_groups([4]) dgs = list(resolved_destination_groups.values()) resolved_output_channels, selector_codes, formatters = \ archive_publish.ArchivePublishService().resolve_output_channels(dgs) subscribers = archive_publish.ArchivePublishService( ).get_subscribers(resolved_output_channels[1]) self.assertEquals(1, subscribers.count()) subscribers = archive_publish.ArchivePublishService( ).get_subscribers(resolved_output_channels[2]) self.assertEquals(2, subscribers.count())
def test_resolve_output_channels_flattened(self): with self.app.app_context(): resolved_destination_groups2 = archive_publish.ArchivePublishService( ).resolve_destination_groups([3]) dgs = list(resolved_destination_groups2.values()) resolved_output_channels, selector_codes, formatters = \ archive_publish.ArchivePublishService().resolve_output_channels(dgs) self.assertEquals(1, len(resolved_output_channels)) self.assertTrue(1 in resolved_output_channels) self.assertTrue(1 in selector_codes) self.assertTrue('A' in selector_codes[1]) self.assertTrue('B' in selector_codes[1]) self.assertEquals(1, len(formatters)) self.assertTrue('nitf' in formatters)
def test_queue_transmission(self): with self.app.app_context(): queue_items = self.app.data.find('publish_queue', None, None) self.assertEquals(0, queue_items.count()) archive_publish.ArchivePublishService().queue_transmission( self.articles[0]) queue_items = self.app.data.find('publish_queue', None, None) self.assertEquals(6, queue_items.count())
def test_resolve_destination_groups(self): with self.app.app_context(): resolved_destination_groups = archive_publish.ArchivePublishService( ).resolve_destination_groups([2]) self.assertEquals(2, len(resolved_destination_groups))