def testUpdateReferenceTime(self):
     try:
         startUpdateValue = '1940-01-01'
         endUpdateValue = '1940-12-31'
         tmpDirectory = tempfile.mkdtemp('', 'tmp_', TEMPLATE_FILES['tmp_dir'])
         mdFile = createTemporaryCopy(TEMPLATE_FILES['child'], tmpDirectory)
         mdEditor = ChildMetadataBinding(mdFile, self.logger)
         response = mdEditor.updateReferenceTime(startUpdateValue, endUpdateValue)
         self.assertTrue(response, 'Function: testUpdateReferenceTime - Response is not like expected.')
         
         # check if value is correctly set
         temporalExtentElement = mdEditor.__getChildElement__(parentElementId=mdEditor.ns['gmd']+'identificationInfo', childElementId=mdEditor.ns['gmd']+'EX_TemporalExtent')
         # test startUpdateValue
         for element in temporalExtentElement.iter(mdEditor.ns['gml']+'begin'):
             timeInstant = element.find(mdEditor.ns['gml']+'TimeInstant')
             timePosition = timeInstant.find(mdEditor.ns['gml']+'timePosition')                
             self.assertEqual(startUpdateValue,timePosition.text, 'Function: testUpdateReferenceTime - Response is not equal to the expected response.')
 
         # test endUpdateValue
         for element in temporalExtentElement.iter(mdEditor.ns['gml']+'end'):
             timeInstant = element.find(mdEditor.ns['gml']+'TimeInstant')
             timePosition = timeInstant.find(mdEditor.ns['gml']+'timePosition')
             self.assertEqual(endUpdateValue,timePosition.text, 'Function: testUpdateReferenceTime - Response is not equal to the expected response.')
     except:
         raise
     finally:
         shutil.rmtree(tmpDirectory)
    def testUpdateBoundingBox(self):
        try:
            updateWestBoundLonValue = 21.49
            updateEastBoundLonValue = 21.66
            updateSouthBoundLatValue = 55.49
            updateNorthBoundLatValue = 55.59
            tmpDirectory = tempfile.mkdtemp("", "tmp_", TEMPLATE_FILES["tmp_dir"])
            mdFile = createTemporaryCopy(TEMPLATE_FILES["child"], tmpDirectory)
            mdEditor = ChildMetadataBinding(mdFile, self.logger)
            response = mdEditor.updateBoundingBox(
                updateWestBoundLonValue, updateEastBoundLonValue, updateSouthBoundLatValue, updateNorthBoundLatValue
            )
            self.assertTrue(response, "Function: testUpdateBoundingBox - Response is not like expected.")

            # check if value is correctly set
            geograhicBoundingBoxElement = mdEditor.__getChildElement__(
                parentElementId=mdEditor.ns["gmd"] + "identificationInfo",
                childElementId=mdEditor.ns["gmd"] + "EX_GeographicBoundingBox",
            )
            # test updateWestBoundLonValue
            for element in geograhicBoundingBoxElement.iter(mdEditor.ns["gmd"] + "westBoundLongitude"):
                valueElement = element.find(mdEditor.ns["gco"] + "Decimal")
                self.assertEqual(
                    updateWestBoundLonValue,
                    valueElement.text,
                    "Function: testUpdateBoundingBox - Response is not equal to the expected response.",
                )

            # test updateEastBoundLonValue
            for element in geograhicBoundingBoxElement.iter(mdEditor.ns["gmd"] + "eastBoundLongitude"):
                valueElement = element.find(mdEditor.ns["gco"] + "Decimal")
                self.assertEqual(
                    updateEastBoundLonValue,
                    valueElement.text,
                    "Function: testUpdateBoundingBox - Response is not equal to the expected response.",
                )

            # test updateSouthBoundLatValue
            for element in geograhicBoundingBoxElement.iter(mdEditor.ns["gmd"] + "southBoundLatitude"):
                valueElement = element.find(mdEditor.ns["gco"] + "Decimal")
                self.assertEqual(
                    updateSouthBoundLatValue,
                    valueElement.text,
                    "Function: testUpdateBoundingBox - Response is not equal to the expected response.",
                )

            # test updateNorthBoundLatValue
            for element in geograhicBoundingBoxElement.iter(mdEditor.ns["gmd"] + "northBoundLatitude"):
                valueElement = element.find(mdEditor.ns["gco"] + "Decimal")
                self.assertEqual(
                    updateNorthBoundLatValue,
                    valueElement.text,
                    "Function: testUpdateBoundingBox - Response is not equal to the expected response.",
                )
        except:
            raise
        finally:
            shutil.rmtree(tmpDirectory)
    def testUpdateReferenceTime(self):
        try:
            startUpdateValue = "1940-01-01"
            endUpdateValue = "1940-12-31"
            tmpDirectory = tempfile.mkdtemp("", "tmp_", TEMPLATE_FILES["tmp_dir"])
            mdFile = createTemporaryCopy(TEMPLATE_FILES["child"], tmpDirectory)
            mdEditor = ChildMetadataBinding(mdFile, self.logger)
            response = mdEditor.updateReferenceTime(startUpdateValue, endUpdateValue)
            self.assertTrue(response, "Function: testUpdateReferenceTime - Response is not like expected.")

            # check if value is correctly set
            temporalExtentElement = mdEditor.__getChildElement__(
                parentElementId=mdEditor.ns["gmd"] + "identificationInfo",
                childElementId=mdEditor.ns["gmd"] + "EX_TemporalExtent",
            )
            # test startUpdateValue
            for element in temporalExtentElement.iter(mdEditor.ns["gml"] + "begin"):
                timeInstant = element.find(mdEditor.ns["gml"] + "TimeInstant")
                timePosition = timeInstant.find(mdEditor.ns["gml"] + "timePosition")
                self.assertEqual(
                    startUpdateValue,
                    timePosition.text,
                    "Function: testUpdateReferenceTime - Response is not equal to the expected response.",
                )

            # test endUpdateValue
            for element in temporalExtentElement.iter(mdEditor.ns["gml"] + "end"):
                timeInstant = element.find(mdEditor.ns["gml"] + "TimeInstant")
                timePosition = timeInstant.find(mdEditor.ns["gml"] + "timePosition")
                self.assertEqual(
                    endUpdateValue,
                    timePosition.text,
                    "Function: testUpdateReferenceTime - Response is not equal to the expected response.",
                )
        except:
            raise
        finally:
            shutil.rmtree(tmpDirectory)
 def testUpdateBoundingBox(self):
     try:
         updateWestBoundLonValue = 21.49
         updateEastBoundLonValue = 21.66
         updateSouthBoundLatValue = 55.49
         updateNorthBoundLatValue = 55.59
         tmpDirectory = tempfile.mkdtemp('', 'tmp_', TEMPLATE_FILES['tmp_dir'])
         mdFile = createTemporaryCopy(TEMPLATE_FILES['child'], tmpDirectory)
         mdEditor = ChildMetadataBinding(mdFile, self.logger)
         response = mdEditor.updateBoundingBox(updateWestBoundLonValue, updateEastBoundLonValue, updateSouthBoundLatValue, updateNorthBoundLatValue)
         self.assertTrue(response, 'Function: testUpdateBoundingBox - Response is not like expected.')
         
         # check if value is correctly set
         geograhicBoundingBoxElement = mdEditor.__getChildElement__(parentElementId=mdEditor.ns['gmd']+'identificationInfo', childElementId=mdEditor.ns['gmd']+'EX_GeographicBoundingBox')
         # test updateWestBoundLonValue
         for element in geograhicBoundingBoxElement.iter(mdEditor.ns['gmd']+'westBoundLongitude'):
             valueElement = element.find(mdEditor.ns['gco']+'Decimal')
             self.assertEqual(updateWestBoundLonValue,valueElement.text, 'Function: testUpdateBoundingBox - Response is not equal to the expected response.')
         
         # test updateEastBoundLonValue
         for element in geograhicBoundingBoxElement.iter(mdEditor.ns['gmd']+'eastBoundLongitude'):
             valueElement = element.find(mdEditor.ns['gco']+'Decimal')
             self.assertEqual(updateEastBoundLonValue,valueElement.text, 'Function: testUpdateBoundingBox - Response is not equal to the expected response.')
         
         # test updateSouthBoundLatValue
         for element in geograhicBoundingBoxElement.iter(mdEditor.ns['gmd']+'southBoundLatitude'):
             valueElement = element.find(mdEditor.ns['gco']+'Decimal')
             self.assertEqual(updateSouthBoundLatValue,valueElement.text, 'Function: testUpdateBoundingBox - Response is not equal to the expected response.')
             
         # test updateNorthBoundLatValue
         for element in geograhicBoundingBoxElement.iter(mdEditor.ns['gmd']+'northBoundLatitude'):
             valueElement = element.find(mdEditor.ns['gco']+'Decimal')
             self.assertEqual(updateNorthBoundLatValue,valueElement.text, 'Function: testUpdateBoundingBox - Response is not equal to the expected response.')
     except:
         raise
     finally:
         shutil.rmtree(tmpDirectory)