"""Test for ows_artist model.""" from models import ows_artist import pytest from models.api_exceptions import PersistentException def test_filter_artists_info_success( mocker, filter_artists_info_success_response, artist_name, filter_artists_info_fixture): """Test filter artists info from ows-artist.""" mocker.patch( 'requests.get', return_value=filter_artists_info_success_response) result = ows_artist.filter_artists_info(artist_name, 12345) assert result == filter_artists_info_fixture def test_filter_artists_info_error( mocker, ows_error_response, artist_name): """Test filter artists info from ows-artist error.""" mocker.patch('requests.get', return_value=ows_error_response) with pytest.raises(PersistentException): ows_artist.filter_artists_info(artist_name, 12345) def test_create_artist_info_success( mocker, create_artist_info_success_response, artist_name, release_artist_fixture): """Test create artist info from ows-artist.""" mocker.patch( 'requests.post', return_value=create_artist_info_success_response) result = ows_artist.create_artist_info(artist_name, 12345) assert result == release_artist_fixture def test_create_artist_info_error( mocker, ows_error_response, artist_name): """Test create artist info from ows-artist error.""" mocker.patch('requests.post', return_value=ows_error_response) with pytest.raises(PersistentException): ows_artist.create_artist_info(artist_name, 12345)