Skip to content

Commit

Permalink
[CPCN-651] improve: Publish Planning on Assignment re-assign (#1925)
Browse files Browse the repository at this point in the history
* [CPCN-651] improve: Publish Planning on Assignment re-assign

* Update assignment actions, due to multiple planning publish per action
  • Loading branch information
MarkLark86 authored Mar 3, 2024
1 parent 7a84d87 commit 875f1cb
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 86 deletions.
96 changes: 54 additions & 42 deletions server/features/assignments_planning_publish.feature
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,8 @@ Feature: For posted planning item changes in assignment state post a planning it
Then we get OK response
Then we store coverage id in "firstcoverage" from coverage 0

@auth @vocabularies
@auth @vocabularies @planning_cvs
Scenario: Publish Planning item on changes to assignment state.
Given "vocabularies"
"""
[{
"_id": "g2_content_type",
"display_name": "Coverage content types",
"type": "manageable",
"unique_field": "qcode",
"selection_type": "do not show",
"items": [
{"is_active": true, "name": "Text", "qcode": "text", "content item type": "text"}
]
}]
"""
When we post to "/planning/post"
"""
{
Expand Down Expand Up @@ -184,7 +171,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": "__no_value__",
"assigned_user": "__no_value__"
}
]
}
Expand Down Expand Up @@ -243,7 +232,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down Expand Up @@ -308,7 +299,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"news_coverage_status": {
"qcode": "ncostat:int"
},
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down Expand Up @@ -377,8 +370,26 @@ Feature: For posted planning item changes in assignment state post a planning it
"coverage_item": "#firstcoverage#"
}
"""
When we transmit items
When we get "published_planning?sort=item_id,version"
Then we get list with 3 items
Then we get list with 4 items
Then we store "PLANNING" with 4 item
When we get "published_planning?where={\"item_id\": \"#PLANNING.item_id#\", \"version\": #PLANNING.version#}"
Then we get list with 1 items
Then we get transmitted item "/tmp/#PLANNING.item_id#-#PLANNING.version#-4.txt"
"""
{
"state": "scheduled",
"pubstatus": "usable",
"coverages": [{
"coverage_id": "#firstcoverage#",
"workflow_status": "active",
"assigned_desk": {"name": "Politics"},
"assigned_user": "__no_value__"
}]
}
"""

When we publish "#ARCHIVE_ID#" with "publish" type and "published" state
Then we get OK response
When we get "/archive/#ARCHIVE_ID#"
Expand All @@ -394,11 +405,11 @@ Feature: For posted planning item changes in assignment state post a planning it
"""
When we transmit items
When we get "published_planning?sort=item_id,version"
Then we get list with 4 items
Then we store "PLANNING" with 4 item
Then we get list with 5 items
Then we store "PLANNING" with 5 item
When we get "published_planning?where={\"item_id\": \"#PLANNING.item_id#\", \"version\": #PLANNING.version#}"
Then we get list with 1 items
Then we get transmitted item "/tmp/#PLANNING.item_id#-#PLANNING.version#-4.txt"
Then we get transmitted item "/tmp/#PLANNING.item_id#-#PLANNING.version#-5.txt"
"""
{
"state": "scheduled",
Expand All @@ -419,7 +430,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [{"item_id": "#ARCHIVE_ID#"}],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Politics"},
"assigned_user": "__no_value__"
}
]
}
Expand Down Expand Up @@ -607,21 +620,8 @@ Feature: For posted planning item changes in assignment state post a planning it
}
"""

@auth @vocabularies
@auth @vocabularies @planning_cvs
Scenario: Publish Planning item on linking and unlinking
Given "vocabularies"
"""
[{
"_id": "g2_content_type",
"display_name": "Coverage content types",
"type": "manageable",
"unique_field": "qcode",
"selection_type": "do not show",
"items": [
{"is_active": true, "name": "Text", "qcode": "text", "content item type": "text"}
]
}]
"""
When we post to "/planning/post"
"""
{
Expand Down Expand Up @@ -691,7 +691,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": "__no_value__",
"assigned_user": "__no_value__"
}
]
}
Expand Down Expand Up @@ -750,7 +752,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down Expand Up @@ -825,7 +829,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down Expand Up @@ -859,7 +865,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [{"item_id": "123"}],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down Expand Up @@ -916,7 +924,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down Expand Up @@ -974,7 +984,9 @@ Feature: For posted planning item changes in assignment state post a planning it
"qcode": "ncostat:int"
},
"deliveries": [{"item_id": "123"}],
"coverage_provider": null
"coverage_provider": null,
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}
]
}
Expand Down
85 changes: 65 additions & 20 deletions server/features/content_rewrite.feature
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ Feature: Rewrite content
"scheduled": "2029-10-12T14:00:00+0000"
},
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "assigned"
"workflow_status": "assigned",
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -276,7 +278,9 @@ Feature: Rewrite content
},
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [{"item_state": "published", "item_id": "#archive._id#"}]
"deliveries": [{"item_state": "published", "item_id": "#archive._id#"}],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand All @@ -296,8 +300,35 @@ Feature: Rewrite content
"assignment_id": "#firstassignment#"
}
"""

When we transmit items
When we get "published_planning?sort=item_id,version"
Then we get list with 3 items
Then we store "PLANNING" with 3 item
Then we get transmitted item "/tmp/#PLANNING.item_id#-#PLANNING.version#-3.txt"
"""
{
"state": "scheduled",
"pubstatus": "usable",
"guid": "#PLANNING.item_id#",
"coverages": [{
"planning": {
"g2_content_type": "text",
"ednote": "test coverage, I want 250 words",
"slugline": "test slugline",
"scheduled": "2029-10-12T14:00:00+0000"
},
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [
{"item_state": "published", "item_id": "#archive._id#", "sequence_no": 0},
{"item_state": "in_progress", "item_id": "#REWRITE_ID#", "sequence_no": 1}
],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
When we get "/published"
Then we get existing resource
"""
Expand Down Expand Up @@ -334,9 +365,11 @@ Feature: Rewrite content
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [
{"item_state": "published", "item_id": "#archive._id#"},
{"item_state": "published", "item_id": "#REWRITE_ID#"}
]
{"item_state": "published", "item_id": "#archive._id#", "sequence_no": 0},
{"item_state": "published", "item_id": "#REWRITE_ID#", "sequence_no": 1}
],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -647,7 +680,9 @@ Feature: Rewrite content
"scheduled": "2029-10-12T14:00:00+0000"
},
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "assigned"
"workflow_status": "assigned",
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -685,7 +720,9 @@ Feature: Rewrite content
},
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [{"item_state": "published", "item_id": "#archive._id#"}]
"deliveries": [{"item_state": "published", "item_id": "#archive._id#"}],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -722,9 +759,11 @@ Feature: Rewrite content
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [
{"item_state": "published", "item_id": "#archive._id#"},
{"item_state": "in_progress", "item_id": "#REWRITE_ID#"}
]
{"item_state": "published", "item_id": "#archive._id#", "sequence_no": 0},
{"item_state": "in_progress", "item_id": "#REWRITE_ID#", "sequence_no": 1}
],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -764,9 +803,11 @@ Feature: Rewrite content
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [
{"item_state": "published", "item_id": "#archive._id#"},
{"item_state": "published", "item_id": "#REWRITE_ID#"}
]
{"item_state": "published", "item_id": "#archive._id#", "sequence_no": 0},
{"item_state": "published", "item_id": "#REWRITE_ID#", "sequence_no": 1}
],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -805,10 +846,12 @@ Feature: Rewrite content
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [
{"item_state": "published", "item_id": "#archive._id#"},
{"item_state": "published", "item_id": "#rewrite1#"},
{"item_state": "in_progress", "item_id": "#REWRITE_ID#"}
]
{"item_state": "published", "item_id": "#archive._id#", "sequence_no": 0},
{"item_state": "published", "item_id": "#rewrite1#", "sequence_no": 1},
{"item_state": "in_progress", "item_id": "#REWRITE_ID#", "sequence_no": 2}
],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down Expand Up @@ -851,9 +894,11 @@ Feature: Rewrite content
"news_coverage_status": {"qcode": "ncostat:int"},
"workflow_status": "completed",
"deliveries": [
{"item_state": "published", "item_id": "#archive._id#"},
{"item_state": "published", "item_id": "#rewrite1#"}
]
{"item_state": "published", "item_id": "#archive._id#", "sequence_no": 0},
{"item_state": "published", "item_id": "#rewrite1#", "sequence_no": 1}
],
"assigned_desk": {"name": "Sports"},
"assigned_user": {"display_name": "test_user"}
}]
}
"""
Expand Down
Loading

0 comments on commit 875f1cb

Please sign in to comment.