import faker import pytest from email_campaigns.rosters.models import CustomList from email_campaigns.rosters.repositories import CustomListRepository from tests.unit.types import CreateModel class TestCustomListRepository: @pytest.mark.db def test_get_allowed_custom_list( self, create_model: CreateModel, repository: CustomListRepository ) -> None: custom_list = create_model(CustomList) result = repository.get_allowed( custom_list_id=custom_list.id, vendor_ids=[custom_list.vendor_id], subaccount_ids=[custom_list.subaccount_id], ) assert result assert result.id == custom_list.id assert result.name == custom_list.name @pytest.mark.db def test_get_allowed_custom_list_not_found( self, repository: CustomListRepository, faker: faker.Faker ) -> None: result = repository.get_allowed( custom_list_id=faker.pystr(), vendor_ids=[faker.pyint()], subaccount_ids=[faker.pyint()], ) assert result is None