def generate_PCR_6_default_config(self, filename): """Generate the WinnForum configuration for PCR 6.""" # File path where SAS UUT claimed ppa boundary generated in PCR.1 test pcr_1_test_config_file_path = os.path.join('testcases', 'configs', 'test_WINNF_FT_S_PCR_1', 'default.config') sas_uut_claimed_ppa_boundary_file_path = getSasUutClaimedPpaBoundaryFilePath( 'default.config') # Load SAS UUT claimed ppa boundary and check if any error while retrieving # SAS UUT claimed ppa boundary generated in PCR.1 test. try: with open(sas_uut_claimed_ppa_boundary_file_path, 'r') as claimed_ppa_file: user_claimed_ppa_contour = json.load(claimed_ppa_file) except IOError: raise RuntimeError( 'ConfigError:There is an error in reading path:%s \n\n' % sas_uut_claimed_ppa_boundary_file_path) # Expand the user claimed ppa boundary by approximately 1 kilometer. user_claimed_ppa_contour_feature_collection = utils.InsureFeatureCollection( utils.ShrinkAndCleanPolygon( user_claimed_ppa_contour['features'][0]['geometry'], -1e-2), as_dict=True) # Create the actual config. config = { 'configPCR_1': pcr_1_test_config_file_path, 'userClaimedPpaContour': user_claimed_ppa_contour_feature_collection } writeConfig(filename, config)
def test_insure_feature_collection(self): with open(os.path.join(TEST_DIR, 'ppa_record_0.json'), 'r') as fd: ppa = json.load(fd) feature_col = ppa['zone'] feature_col_str = json.dumps(feature_col) feature = ppa['zone']['features'][0] geometry = ppa['zone']['features'][0]['geometry'] geometry_str = json.dumps(geometry) self.assertDictEqual( utils.InsureFeatureCollection(feature_col, as_dict=True), feature_col) self.assertDictEqual( utils.InsureFeatureCollection(feature_col_str, as_dict=True), feature_col) self.assertDictEqual( utils.InsureFeatureCollection(feature, as_dict=True), feature_col) self.assertDictEqual( utils.InsureFeatureCollection(geometry, as_dict=True), feature_col) self.assertDictEqual( utils.InsureFeatureCollection(geometry_str, as_dict=True), feature_col) self.assertEqual(utils.InsureFeatureCollection(geometry), feature_col_str) self.assertEqual(utils.InsureFeatureCollection(geometry_str), feature_col_str)