def setUp(self):
        super(GeoTestCase, self).setUp()

        # Start with a clean database for each test.
        Country.objects.all().delete()
        SubRegion.objects.all().delete()
        Region.objects.all().delete()

        # A test Region that is needed by the test SubRegion.
        region = Region()
        region.name = "Test Region"
        region.numeric_code = "001"
        region.save()

        # A test SubRegion that is needed by the test Country.
        subregion = SubRegion()
        subregion.name = "Test SubRegion"
        subregion.numeric_code = "002"
        subregion.region = region
        subregion.save()

        # Setup the test Country.
        self.country = Country()
        self.country.name = "Test"
        self.country.subregion = subregion
        self.country.save()
Exemple #2
0
    def setUp(self):
        super(GeoTestCase, self).setUp()

        # Start with a clean database for each test.
        Country.objects.all().delete()
        SubRegion.objects.all().delete()
        Region.objects.all().delete()

        # A test Region that is needed by the test SubRegion.
        region = Region()
        region.name = "Test Region"
        region.numeric_code = "001"
        region.save()

        # A test SubRegion that is needed by the test Country.
        subregion = SubRegion()
        subregion.name = "Test SubRegion"
        subregion.numeric_code = "002"
        subregion.region = region
        subregion.save()

        # Setup the test Country.
        self.country = Country()
        self.country.name = "Test"
        self.country.subregion = subregion
        self.country.save()
    def create_region(self, name, numeric_code):
        region = Region(name=name, numeric_code=numeric_code)
        region.save()

        return region
Exemple #4
0
    def create_region(self, name, numeric_code):
        region = Region(name=name, numeric_code=numeric_code)
        region.save()

        return region