def generate_test_metadata(self, layer=None):
     # if you change this you need to update GENERIC_TEST_FILE_JSON
     if layer is None:
         layer = 'random_layer_id'
     metadata = GenericLayerMetadata(layer)
     path = 'gmd:MD_Metadata/gmd:dateStamp/gco:CharacterString'
     # using str
     test_value = 'Random string'
     metadata.set('ISO19115_STR', test_value, path)
     test_value = 1234
     metadata.set('ISO19115_INT', test_value, path)
     test_value = 1234.5678
     metadata.set('ISO19115_FLOAT', test_value, path)
     metadata.report = 'My super report'
     return metadata
 def generate_test_metadata(self, layer=None):
     # if you change this you need to update GENERIC_TEST_FILE_JSON
     if layer is None:
         layer = 'random_layer_id'
     metadata = GenericLayerMetadata(layer)
     path = 'gmd:MD_Metadata/gmd:dateStamp/gco:CharacterString'
     # using str
     test_value = 'Random string'
     metadata.set('ISO19115_STR', test_value, path)
     test_value = 1234
     metadata.set('ISO19115_INT', test_value, path)
     test_value = 1234.5678
     metadata.set('ISO19115_FLOAT', test_value, path)
     metadata.report = 'My super report'
     return metadata
    def test_json_read(self):
        metadata = GenericLayerMetadata(EXISTING_GENERIC_FILE)
        with open(EXISTING_GENERIC_JSON) as f:
            expected_metadata = f.read()

        self.assertEqual(expected_metadata, metadata.json)