def test_sorted_by_hierachy_removes_country_types(self):
        slugs = list(LocationType.objects.all().values_list('slug', flat=True))
        old_data = {}
        for slug in slugs:
            old_data[slug] = 'dummy haha' + str(randint)

        location_widget = LocationWidget(selected_location=self.kampala_city)
        new_data = location_widget.sorted_by_hierarchy(old_data)

        self.assertNotIn('country', new_data.keys())
        [self.assertEqual(old_data[key], new_data[key]) for key in new_data.keys()]
Esempio n. 2
0
    def test_sorted_by_hierachy_removes_country_types(self):
        slugs = list(LocationType.objects.all().values_list('slug', flat=True))
        old_data = {}
        for slug in slugs:
            old_data[slug] = 'dummy haha' + str(randint)

        location_widget = LocationWidget(selected_location=self.kampala_city)
        new_data = location_widget.sorted_by_hierarchy(old_data)

        self.assertNotIn('country', new_data.keys())
        [
            self.assertEqual(old_data[key], new_data[key])
            for key in new_data.keys()
        ]