コード例 #1
0
 def test_delete_encoded_item(self, fake_app):
     fake_storage = fake_app.storage
     fake_storage_delete = fake_storage.delete
     service = publish_queue.PublishQueueService(backend=MagicMock())
     service.get_from_mongo = MagicMock()
     service.get_from_mongo.return_value = [{'_id': "4567", 'encoded_item_id': 'TEST ID'}]
     service.delete({'_id': "4567"})
     fake_storage_delete.call_args == mock.call('TEST ID')
コード例 #2
0
 def test_delete_encoded_item(self, fake_app):
     fake_storage = fake_app.storage
     fake_storage_delete = fake_storage.delete
     service = publish_queue.PublishQueueService(backend=MagicMock())
     service.get_from_mongo = MagicMock()
     cursor = UserList([{"_id": "4567", "encoded_item_id": "TEST ID"}])
     cursor.sort = MagicMock()
     cursor.sort.return_value = cursor
     service.get_from_mongo.return_value = cursor
     service.delete({"_id": "4567"})
     assert fake_storage_delete.call_args == mock.call("TEST ID")
コード例 #3
0
    def test_delete_from_queue_by_article_id(self):
        self._is_publish_queue_empty()

        doc = copy(self.articles[7])
        doc['item_id'] = doc['_id']

        archive_publish = get_resource_service(ARCHIVE_PUBLISH)
        archive_publish.patch(id=doc['_id'], updates={ITEM_STATE: CONTENT_STATE.PUBLISHED})

        enqueue_published()
        queue_items = self.app.data.find(PUBLISH_QUEUE, None, None)
        self.assertEqual(4, queue_items.count())

        # this will delete queue transmission for the wire article not the takes package.
        publish_queue.PublishQueueService(PUBLISH_QUEUE, superdesk.get_backend()).delete_by_article_id(doc['_id'])
        self._is_publish_queue_empty()