Skip to content

Commit

Permalink
Using system_update to modify the schedule item instead of patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayur Dhamanwala authored and petrjasek committed Oct 11, 2016
1 parent fe34c83 commit 043d518
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
4 changes: 3 additions & 1 deletion apps/publish/enqueue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ def enqueue_item(published_item):
resolve_document_version(document=item_updates, resource=ARCHIVE,
method='PATCH',
latest_doc={config.VERSION: published_item[config.VERSION]})

# update the archive collection
archive_service.patch(published_item['item_id'], item_updates)
archive_item = archive_service.find_one(req=None, _id=published_item['item_id'])
archive_service.system_update(published_item['item_id'], item_updates, archive_item)
# insert into version.
insert_into_versions(published_item['item_id'], doc=None)
# import to legal archive
Expand Down
26 changes: 23 additions & 3 deletions features/content_publish.feature
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ Feature: Content Publishing
{"_issues": {"validator exception": "500: Failed to publish the item: PublishQueueError Error 9009 - Item could not be queued"}}
"""

@auth @test
@auth
Scenario: Schedule a user content publish
Given empty "subscribers"
And "desks"
Expand Down Expand Up @@ -595,6 +595,23 @@ Feature: Content Publishing
{"_current_version": 2, "state": "scheduled", "operation": "publish"}
"""
And we get expiry for schedule and embargo content 60 minutes after "#archive_publish.publish_schedule#"
When we get "/published"
Then we get list with 2 items
"""
{
"_items": [
{
"_id": "123", "type": "text", "state": "scheduled",
"_current_version": 2, "operation": "publish", "queue_state": "pending"
},
{
"_id": "#archive.123.take_package#", "type": "composite",
"state": "scheduled", "_current_version": 2, "operation": "publish",
"queue_state": "pending"
}
]
}
"""
When we enqueue published
When we get "/publish_queue"
Then we get list with 0 items
Expand All @@ -611,10 +628,13 @@ Feature: Content Publishing
{
"_items": [
{
"_id": "123", "type": "text", "state": "published", "_current_version": 3
"_id": "123", "type": "text", "state": "published",
"_current_version": 3, "operation": "publish", "queue_state": "queued_not_transmitted"
},
{
"_id": "#archive.123.take_package#", "type": "composite", "state": "published", "_current_version": 3
"_id": "#archive.123.take_package#", "type": "composite",
"state": "published", "_current_version": 3, "operation": "publish",
"queue_state": "queued"
}
]
}
Expand Down

0 comments on commit 043d518

Please sign in to comment.