"""Tests for country model.""" from abacus_legacy_sync.models.country import Country from tests.utils.factories import CountryFactory def test_create_country_item(): """Test creating a row in a database.""" assert Country.count() == 0 CountryFactory.create() assert Country.count() == 1 def test_get_by_iso_codes(): """Test getting a country list iso codes.""" for country_name, iso_code, country_code in [ ('Germany', 'DEU', 'DE'), ('Sweden', 'SWE', 'SE'), ]: CountryFactory.create( name=country_name, country_code=country_code, iso3166a3=iso_code ) result = Country.get_by_iso_codes(['DEU', 'SWE']) assert len(result) == 2