"""Tests for ows-product-digital interface.""" from backend.models import ows_product_workflow from tests.testutils import mocks def test_get_last_release_correction(mocker, test_correlation_id, test_correction_id, test_product_id, test_track_correction_data): """Get last release correction data.""" mock_request_get = mocks.get_response(mocker, json=test_track_correction_data.copy()) res = ows_product_workflow.get_last_release_correction( product_id=test_product_id, correlation_id=test_correlation_id) mock_request_get.assert_called_with( 'ows-product-workflow', '/product/{}/correction'.format(test_product_id), correlation_id=test_correlation_id) assert res assert res.message == test_track_correction_data def test_get_last_release_correction_error(mocker, test_correlation_id, test_correction_id, test_product_id, test_track_correction_data): """Get last release correction data when error.""" error_obj = {'code': 'not_found_error', 'message': None} mock_request_get = mocks.get_response( mocker, json=error_obj.copy(), status_code=400) res = ows_product_workflow.get_last_release_correction( product_id=test_product_id, correlation_id=test_correlation_id) mock_request_get.assert_called_with( 'ows-product-workflow', '/product/{}/correction'.format(test_product_id), correlation_id=test_correlation_id) assert not res assert res.errors['message'] == error_obj['message']