Beispiel #1
0
    def testUpdateHierarchyLevelName(self):
        try:
            updateValue = 'Messtischblatt'
            tmpDirectory = tempfile.mkdtemp('', 'tmp_',
                                            TEMPLATE_FILES['tmp_dir'])
            mdFile = createTemporaryCopy(TEMPLATE_FILES['child'], tmpDirectory)
            mdEditor = ChildMetadataBinding(mdFile, self.logger)
            response = mdEditor.updateHierarchyLevelName(updateValue)
            self.assertTrue(
                response,
                'Function: testUpdateHierarchyLevelName - Response is not like expected.'
            )

            # check if value is correctly set
            for element in mdEditor.root.iter(mdEditor.ns['gmd'] +
                                              'hierarchyLevelName'):
                valueElement = mdEditor.__getCharacterStringElement__(element)
                self.assertEqual(
                    updateValue, valueElement.text,
                    'Function: testUpdateHierarchyLevelName - Response is not equal to the expected response.'
                )
        except:
            raise
        finally:
            shutil.rmtree(tmpDirectory)
 def testUpdateAbstract(self):
     try:
         updateValue = 'Grünheide b. Wilkieten. - Hrsg. 1911, red. Änd. 1939. - 1:25000. - [Berlin]: Reichsamt für Landesaufnahme, 1939. - 1 Kt. ---'
         tmpDirectory = tempfile.mkdtemp('', 'tmp_', TEMPLATE_FILES['tmp_dir'])
         mdFile = createTemporaryCopy(TEMPLATE_FILES['child'], tmpDirectory)
         mdEditor = ChildMetadataBinding(mdFile, self.logger)
         response = mdEditor.updateAbstract(updateValue)
         self.assertTrue(response, 'Function: testUpdateAbstract - Response is not like expected.')
         
         # check if value is correctly set
         for element in mdEditor.root.iter(mdEditor.ns['gmd']+'abstract' ):
             valueElement = mdEditor.__getCharacterStringElement__(element)
             self.assertEqual(updateValue,valueElement.text, 'Function: testUpdateAbstract - Response is not equal to the expected response.')
     except:
         raise
     finally:
         shutil.rmtree(tmpDirectory)
 def testUpdateTitle(self):
     try:
         updateValue = 'Meßtischblatt 0495 : Grünheide b. Wilkieten, 19399'
         tmpDirectory = tempfile.mkdtemp('', 'tmp_', TEMPLATE_FILES['tmp_dir'])
         mdFile = createTemporaryCopy(TEMPLATE_FILES['child'], tmpDirectory)
         mdEditor = ChildMetadataBinding(mdFile, self.logger)
         response = mdEditor.updateTitle(updateValue)
         self.assertTrue(response, 'Function: testTitle - Response is not like expected.')
         
         # check if value is correctly set
         for element in mdEditor.root.iter(mdEditor.ns['gmd']+'title' ):
             valueElement = mdEditor.__getCharacterStringElement__(element)
             self.assertEqual(updateValue,valueElement.text, 'Function: testTitle - Response is not equal to the expected response.')
     except:
         raise
     finally:
         shutil.rmtree(tmpDirectory)
 def testUpdateId(self):
     try:
         updateValue = 'df_dk_0010001_0192'
         tmpDirectory = tempfile.mkdtemp('', 'tmp_', TEMPLATE_FILES['tmp_dir'])
         mdFile = createTemporaryCopy(TEMPLATE_FILES['child'], tmpDirectory)
         mdEditor = ChildMetadataBinding(mdFile, self.logger)
         response = mdEditor.updateId(updateValue)
         self.assertTrue(response, 'Function: testUpdateId - Response is not like expected.')
         
         # check if value is correctly set
         for element in mdEditor.root.iter(mdEditor.ns['gmd']+'fileIdentifier' ):
             valueElement = mdEditor.__getCharacterStringElement__(element)
             self.assertEqual(updateValue,valueElement.text, 'Function: testUpdateId - Response is not equal to the expected response.')
     except:
         raise
     finally:
         shutil.rmtree(tmpDirectory)
    def testUpdateHierarchyLevelName(self):
        try:
            updateValue = "Messtischblatt"
            tmpDirectory = tempfile.mkdtemp("", "tmp_", TEMPLATE_FILES["tmp_dir"])
            mdFile = createTemporaryCopy(TEMPLATE_FILES["child"], tmpDirectory)
            mdEditor = ChildMetadataBinding(mdFile, self.logger)
            response = mdEditor.updateHierarchyLevelName(updateValue)
            self.assertTrue(response, "Function: testUpdateHierarchyLevelName - Response is not like expected.")

            # check if value is correctly set
            for element in mdEditor.root.iter(mdEditor.ns["gmd"] + "hierarchyLevelName"):
                valueElement = mdEditor.__getCharacterStringElement__(element)
                self.assertEqual(
                    updateValue,
                    valueElement.text,
                    "Function: testUpdateHierarchyLevelName - Response is not equal to the expected response.",
                )
        except:
            raise
        finally:
            shutil.rmtree(tmpDirectory)