"""Image Status Model Tests. Testing the persistence of the image status model """ import pytest from images import response from images.models import image_status as image_status_model from tests.factories.image_status import ImportAssetFactory from tests.utils import db @pytest.fixture def test_import_asset_id(): """Return an import asset id for testing.""" return 1234567 def test_get_import_asset_for_image(test_schema, test_import_asset_id): """Test that artists are properly filtered by vendor_id.""" import_asset = ImportAssetFactory.build(id=test_import_asset_id) db.seed_models(import_asset) result = image_status_model.get_import_asset_for_image( test_import_asset_id) result_import_asset = result.message assert result_import_asset.get('import_asset_id') == test_import_asset_id def test_vendor_id_subaccount_not_found(test_schema, test_import_asset_id): """Test getting a 404 from import_asset for the given image.""" result = image_status_model.get_import_asset_for_image( test_import_asset_id) assert result.status == 404 assert result.message is None assert result.errors == { 'code': response.ERROR_CODE_NOT_FOUND, 'message': 'image asset not found'}