mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-16 20:48:37 -04:00
Add service versioning to broadcast account type change
We are using the `set_broadcast_service_type` route to make changes to service objects. However, we had forgotten to add the `version_class` decorator to it which will mean the changing of a service going from training to live mode will also be recorded in the services_history table for free. Whilst not essential, this easy change makes things more consistent for how we update other services.
This commit is contained in:
@@ -4059,3 +4059,23 @@ def test_set_as_broadcast_service_errors_if_no_mobile_provider_restriction(
|
||||
_data=data,
|
||||
_expected_status=400,
|
||||
)
|
||||
|
||||
|
||||
def test_set_as_broadcast_service_updates_services_history(
|
||||
admin_request, sample_service, broadcast_organisation
|
||||
):
|
||||
old_history_records = Service.get_history_model().query.filter_by(id=sample_service.id).all()
|
||||
data = {
|
||||
'broadcast_channel': 'test',
|
||||
'service_mode': 'live',
|
||||
'provider_restriction': None,
|
||||
}
|
||||
|
||||
admin_request.post(
|
||||
'service.set_as_broadcast_service',
|
||||
service_id=sample_service.id,
|
||||
_data=data,
|
||||
)
|
||||
|
||||
new_history_records = Service.get_history_model().query.filter_by(id=sample_service.id).all()
|
||||
assert len(new_history_records) == len(old_history_records) + 1
|
||||
|
||||
Reference in New Issue
Block a user