Exemplo n.º 1
0
    def test_load_states(self):
        """Should load the correct states from the file"""
        filename = save_content_to_tmp_file(STATES_FILE)
        utils.load_states_from_file(filename)

        acre = models.State.objects.get(code=12)
        sao_paulo = models.State.objects.get(code=35)

        self.assertEqual('AC', acre.abbr)
        self.assertEqual('Acre', acre.name)

        self.assertEqual('SP', sao_paulo.abbr)
        self.assertEqual('São Paulo', sao_paulo.name)
Exemplo n.º 2
0
    def test_load_states(self):
        """Should load the correct states from the file"""
        filename = save_content_to_tmp_file(STATES_FILE)
        utils.load_states_from_file(filename)

        acre = models.State.objects.get(code=12)
        sao_paulo = models.State.objects.get(code=35)

        self.assertEqual('AC', acre.abbr)
        self.assertEqual('Acre', acre.name)

        self.assertEqual('SP', sao_paulo.abbr)
        self.assertEqual('São Paulo', sao_paulo.name)
Exemplo n.º 3
0
    def test_load_cities(self):
        """Should load the correct cities from the file"""
        states_file = save_content_to_tmp_file(STATES_FILE)
        cities_file = save_content_to_tmp_file(CITIES_FILE)
        utils.load_states_from_file(states_file)
        utils.load_cities_from_file(cities_file)

        acrelandia = models.City.objects.get(code=120001)
        araras = models.City.objects.get(code=350330)

        self.assertEqual('AC', acrelandia.state.abbr)
        self.assertEqual('Acrelândia', acrelandia.name)
        self.assertEqual('acrelandia', acrelandia.search_name)

        self.assertEqual('SP', araras.state.abbr)
        self.assertEqual('Araras', araras.name)
        self.assertEqual('araras', araras.search_name)
Exemplo n.º 4
0
    def test_load_cities(self):
        """Should load the correct cities from the file"""
        states_file = save_content_to_tmp_file(STATES_FILE)
        cities_file = save_content_to_tmp_file(CITIES_FILE)
        utils.load_states_from_file(states_file)
        utils.load_cities_from_file(cities_file)

        acrelandia = models.City.objects.get(code=120001)
        araras = models.City.objects.get(code=350330)

        self.assertEqual('AC', acrelandia.state.abbr)
        self.assertEqual('Acrelândia', acrelandia.name)
        self.assertEqual('acrelandia', acrelandia.search_name)

        self.assertEqual('SP', araras.state.abbr)
        self.assertEqual('Araras', araras.name)
        self.assertEqual('araras', araras.search_name)
Exemplo n.º 5
0
 def handle(self, *args, **options):
     country = 'Brazil'
     utils.load_states_from_file(utils.get_states_filename(country))
     utils.load_cities_from_file(utils.get_cities_filename(country))
Exemplo n.º 6
0
 def handle(self, *args, **options):
     country = "Brazil"
     utils.load_states_from_file(utils.get_states_filename(country))
     utils.load_cities_from_file(utils.get_cities_filename(country))