Пример #1
0
    def test_file_write_fail(self):
        self.fixtures = os.path.join(os.path.abspath(os.path.dirname(__file__) + '/xyz'))
        item = {'item_id': 'test_file_name',
                'item_version': 1,
                'formatted_item': 'I was here'
                }

        service = FilePublishService()
        try:
            service._transmit(item, {}, self.output_channel)
        except PublishFileError as ex:
            self.assertEqual(ex.message, 'File publish error')
            self.assertEqual(ex.code, 13000)
Пример #2
0
 def test_file_write_string(self):
     item = {'item_id': 'test_file_name',
             'item_version': 1,
             'formatted_item': 'I was here'
             }
     service = FilePublishService()
     try:
         service._transmit(item, {}, self.output_channel)
         self.assertTrue(True)
     finally:
         path = os.path.join(self.fixtures, 'test_file_name-1.txt')
         if os.path.isfile(path):
             os.remove(path)
Пример #3
0
    def test_file_write_fail(self):
        self.fixtures = os.path.join(os.path.abspath(os.path.dirname(__file__) + '/xyz'))
        item = {'item_id': 'test_file_name',
                'item_version': 1,
                'formatted_item': 'I was here',
                'destination': {"name": "test", "delivery_type": "File", "format": "nitf",
                                "config": {"file_path": self.fixtures}}
                }

        with self.app.app_context():
            service = FilePublishService()
            try:
                service._transmit(item, self.subscribers)
            except PublishFileError as ex:
                self.assertEqual(ex.message, 'File publish error')
                self.assertEqual(ex.code, 13000)
Пример #4
0
 def test_file_write_string(self):
     item = {'item_id': 'test_file_name',
             'item_version': 1,
             'published_seq_num': 1,
             'formatted_item': 'I was here',
             'destination': {"name": "test", "delivery_type": "File", "format": "nitf",
                             "config": {"file_path": self.fixtures}}
             }
     service = FilePublishService()
     try:
         service._transmit(item, self.subscribers)
         self.assertTrue(True)
     finally:
         path = os.path.join(self.fixtures, 'test_file_name-1-1.txt')
         if os.path.isfile(path):
             os.remove(path)