def test_load_fixtures(self):
        """
        Test load_fixtures calls load_fixture with country,
        region, subregion and city path.
        """
        fixtures_dir = os.path.join(DATA_DIR, 'fixtures')
        with mock.patch.object(Command, 'load_fixture') as mock_func:
            cmd = Command()
            # paths
            cmd.country_path = os.path.join(fixtures_dir, cmd.COUNTRY_FIXTURE)
            cmd.region_path = os.path.join(fixtures_dir, cmd.REGION_FIXTURE)
            cmd.subregion_path = os.path.join(fixtures_dir,
                                              cmd.SUBREGION_FIXTURE)
            cmd.city_path = os.path.join(fixtures_dir, cmd.CITY_FIXTURE)
            # URLs
            cmd.country_url = FIXTURES_BASE_URL + cmd.COUNTRY_FIXTURE
            cmd.region_url = FIXTURES_BASE_URL + cmd.REGION_FIXTURE
            cmd.subregion_url = FIXTURES_BASE_URL + cmd.SUBREGION_FIXTURE
            cmd.city_url = FIXTURES_BASE_URL + cmd.CITY_FIXTURE

            cmd.load_fixtures(force_fetch=True)
            mock_func.assert_any_call(cmd.country_url,
                                      cmd.country_path,
                                      force=True)
            mock_func.assert_any_call(cmd.region_url,
                                      cmd.region_path,
                                      force=True)
            mock_func.assert_any_call(cmd.subregion_url,
                                      cmd.subregion_path,
                                      force=True)
            mock_func.assert_any_call(cmd.city_url, cmd.city_path, force=True)
 def test_dump_fixtures(self):
     """
     Test dump_fixtures calls dump_fixture with Country,
     Region and City table names.
     """
     fixtures_dir = os.path.join(DATA_DIR, 'fixtures')
     with mock.patch.object(Command, 'dump_fixture') as mock_func:
         cmd = Command()
         cmd.country_path = os.path.join(fixtures_dir, cmd.COUNTRY_FIXTURE)
         cmd.region_path = os.path.join(fixtures_dir, cmd.REGION_FIXTURE)
         cmd.city_path = os.path.join(fixtures_dir, cmd.CITY_FIXTURE)
         cmd.dump_fixtures()
         mock_func.assert_any_call('cities_light.Country', cmd.country_path)
         mock_func.assert_any_call('cities_light.Region', cmd.region_path)
         mock_func.assert_any_call('cities_light.City', cmd.city_path)
 def test_dump_fixtures(self):
     """
     Test dump_fixtures calls dump_fixture with Country,
     Region and City table names.
     """
     fixtures_dir = os.path.join(DATA_DIR, 'fixtures')
     with mock.patch.object(Command, 'dump_fixture') as mock_func:
         cmd = Command()
         cmd.country_path = os.path.join(fixtures_dir, cmd.COUNTRY_FIXTURE)
         cmd.region_path = os.path.join(fixtures_dir, cmd.REGION_FIXTURE)
         cmd.city_path = os.path.join(fixtures_dir, cmd.CITY_FIXTURE)
         cmd.dump_fixtures()
         mock_func.assert_any_call('cities_light.Country', cmd.country_path)
         mock_func.assert_any_call('cities_light.Region', cmd.region_path)
         mock_func.assert_any_call('cities_light.City', cmd.city_path)
    def test_load_fixtures(self):
        """
        Test load_fixtures calls load_fixture with country,
        region and city path.
        """
        fixtures_dir = os.path.join(DATA_DIR, 'fixtures')
        with mock.patch.object(Command, 'load_fixture') as mock_func:
            cmd = Command()
            cmd.country_path = os.path.join(fixtures_dir, cmd.COUNTRY_FIXTURE)
            cmd.region_path = os.path.join(fixtures_dir, cmd.REGION_FIXTURE)
            cmd.city_path = os.path.join(fixtures_dir, cmd.CITY_FIXTURE)
            cmd.country_url = FIXTURES_BASE_URL + cmd.COUNTRY_FIXTURE
            cmd.region_url = FIXTURES_BASE_URL + cmd.REGION_FIXTURE
            cmd.city_url = FIXTURES_BASE_URL + cmd.CITY_FIXTURE

            cmd.load_fixtures(force_fetch=True)
            mock_func.assert_any_call(
                cmd.country_url, cmd.country_path, force=True)
            mock_func.assert_any_call(
                cmd.region_url, cmd.region_path, force=True)
            mock_func.assert_any_call(
                cmd.city_url, cmd.city_path, force=True)