"""Test ows-notifications.""" import requests from owsrequest import request from pytest_mock import MockerFixture from video.constants import notifications as constants from video.models.ows import notifications def test_create_notification(mocker: MockerFixture) -> None: """Test create notification.""" ows_notifications_response = requests.Response() ows_notifications_response.status_code = 201 mocker.patch.object( request, "process", return_value=ows_notifications_response, ) expected_return_value = 201 project_id = 1337 product_id = 133737 video_title = "the 133737 there ever was" upc = 1337337337 isrc = "AB354833" artist_name = "barry 1337" account_type = "vendor" account_id = 1337 expected_data = { "feedName": constants.APPROVAL_FEED_NAME, "feedId": f"{account_type}_{account_id}", "payload": { "actor": constants.APPROVAL_ACTOR, "verb": constants.APPROVAL_VERB, "object": constants.APPROVAL_OBJECT, "project_id": project_id, "product_id": product_id, "video_title": video_title, "upc": upc, "isrc": isrc, "artist_name": artist_name, }, } mocked_request = mocker.patch.object( request, "process", return_value=ows_notifications_response ) return_value = notifications.create_notification(expected_data) assert expected_return_value == return_value.status_code mocked_request.assert_called_with( application="ows-video", environment="test", method="POST", service_name="ows-notifications", path="/activity", uwsgi_cache_enabled=True, json=expected_data, )