def check_parse_manifest(self, test_manifest, regen=False): """ Test the parsing of MANIFEST.MF at test_manifest against an expected JSON from the same name with a .json extension. """ test_manifest_loc = self.get_test_loc(test_manifest) expected_manifest_loc = test_manifest_loc + '.json' parsed_manifest = parse_manifest(location=test_manifest_loc) if regen: with open(expected_manifest_loc, 'wb') as ex: json.dump(parsed_manifest, ex, indent=2) with io.open(expected_manifest_loc, encoding='utf-8') as ex: expected = json.load(ex, object_pairs_hook=OrderedDict) assert json.dumps(expected) == json.dumps(parsed_manifest)
def check_parse_manifest(self, test_manifest, regen=REGEN_TEST_FIXTURES): """ Test the parsing of MANIFEST.MF at test_manifest against an expected JSON from the same name with a .json extension. """ test_manifest_loc = self.get_test_loc(test_manifest) expected_manifest_loc = test_manifest_loc + '.json' parsed_manifest = parse_manifest(location=test_manifest_loc) if regen: with open(expected_manifest_loc, mode) as ex: json.dump(parsed_manifest, ex, indent=2) with io.open(expected_manifest_loc, encoding='utf-8') as ex: expected = json.load(ex) assert json.dumps(parsed_manifest) == json.dumps(expected)
def check_get_normalized_package_data(self, test_manifest, regen=False): """ Test the get_normalized_package_data() function using the MANIFEST file at `test_manifest` against an expected JSON from the same name with a .package-data.json extension. """ test_manifest_loc = self.get_test_loc(test_manifest) manifest_sections = parse_manifest(test_manifest_loc) package = get_normalized_package_data(manifest_sections[0]) or {} expected_json_loc = test_manifest_loc + '.package-data.json' if regen: with open(expected_json_loc, 'wb') as ex: json.dump(package, ex, indent=2) with io.open(expected_json_loc, encoding='utf-8') as ex: expected = json.load(ex, object_pairs_hook=OrderedDict) assert json.dumps(expected) == json.dumps(package)
def check_get_normalized_java_manifest_data(self, test_manifest, regen=REGEN_TEST_FIXTURES): """ Test the get_normalized_java_manifest_data() function using the MANIFEST file at `test_manifest` against an expected JSON from the same name with a .package-data.json extension. """ test_manifest_loc = self.get_test_loc(test_manifest) manifest_sections = parse_manifest(test_manifest_loc) package = get_normalized_java_manifest_data(manifest_sections[0]) or {} expected_json_loc = test_manifest_loc + '.package-data.json' if regen: with open(expected_json_loc, mode) as ex: json.dump(package, ex, indent=2) with io.open(expected_json_loc) as ex: expected = json.load(ex) assert json.dumps(package) == json.dumps(expected)