def generate_categories_with_regions(self, driving_dataset): # Add categories cat1 = LandCoverRegionCategory() cat1.driving_dataset_id = driving_dataset.id cat1.name = "Rivers" cat1.id = 1 region1 = LandCoverRegion() region1.id = 1 region1.name = "Thames" region1.category_id = 1 region1.category = cat1 region2 = LandCoverRegion() region2.id = 2 region2.name = "Itchen" region2.category_id = 1 region2.category = cat1 cat1.regions = [region1, region2] cat2 = LandCoverRegionCategory() cat2.driving_dataset_id = driving_dataset.id cat2.name = "Counties" cat2.id = 2 region3 = LandCoverRegion() region3.id = 3 region3.name = "Hampshire" region3.category_id = 2 region3.category = cat2 region4 = LandCoverRegion() region4.id = 4 region4.name = "Oxfordshire" region4.category_id = 2 region4.category = cat2 cat2.regions = [region3, region4] return [cat1, cat2]
def _mock_get_land_cover_categories(driving_data_id): cat1 = LandCoverRegionCategory() cat1.driving_dataset_id = driving_data_id cat1.name = "Rivers" cat1.id = 1 region1 = LandCoverRegion() region1.id = 1 region1.name = "Thames" region1.category_id = 1 region1.category = cat1 region2 = LandCoverRegion() region2.id = 2 region2.name = "Itchen" region2.category_id = 1 region2.category = cat1 cat1.regions = [region1, region2] cat2 = LandCoverRegionCategory() cat2.driving_dataset_id = driving_data_id cat2.name = "Counties" cat2.id = 2 region3 = LandCoverRegion() region3.id = 3 region3.name = "Hampshire" region3.category_id = 2 region3.category = cat2 region4 = LandCoverRegion() region4.id = 4 region4.name = "Oxfordshire" region4.category_id = 2 region4.category = cat2 cat2.regions = [region3, region4] return [cat1, cat2]