"""Ows-podcast model tier tests.""" from unittest.mock import patch from participant.models.ows import ows_podcast as ows_podcast_model @patch('participant.models.ows.ows_podcast.get_ows_headers') @patch('participant.models.ows.ows_podcast.request') def test_current_user_owns_network_id_success(request_mock, get_headers_mock): """Test current_user_owns_network_id function.""" request_mock.get.return_value.json.return_value = {'authorized': True} get_headers_mock.return_value = {'user_id': 'cow'} result = ows_podcast_model.current_user_owns_network_id(1) assert result.status == 200 assert result.message == {'authorized': True} @patch('participant.models.ows.ows_podcast.get_ows_headers') @patch('participant.models.ows.ows_podcast.request') def test_current_user_owns_network_id_fails(request_mock, get_headers_mock): """Test current_user_owns_network_id function with negative scenario.""" request_mock.get.return_value.json.return_value = {'authorized': False} get_headers_mock.return_value = {'user_id': 'cow'} result = ows_podcast_model.current_user_owns_network_id(1) assert result.status == 403 assert result.errors == { 'code': 'access_forbidden', 'message': 'Access is forbidden', }