"""Tests for art_relations logic.""" import pytest from src.logic import art_relations from src.models.metadata import ProductParticipation @pytest.fixture def execute_query_mock(mocker): """Mock execute_query.""" return mocker.patch.object(art_relations, 'execute_query') class TestGetProductParticipations: """Tests for get_product_participations.""" def test_get_product_participations(self, execute_query_mock): """Test get_product_participations.""" execute_query_mock.return_value = [ { 'artist_id': 1, 'artist_name': 'The Beatles', 'artist_role': 'performer', }, { 'artist_id': 2, 'artist_name': 'George Martin', 'artist_role': 'producer', }, ] expected_result = [ ProductParticipation( product_id=1, participant_id=1, participant_name='The Beatles', participant_participated_as='performer', ), ProductParticipation( product_id=1, participant_id=2, participant_name='George Martin', participant_participated_as='producer', ), ] result = art_relations.get_product_participations(1) assert result == expected_result