{"action":"created","comment":{"url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments/70526657","id":70526657,"diff_hunk":"@@ -0,0 +1,1241 @@\n+import tempfile\r\n+import shutil\r\n+import os\r\n+\r\n+from django.test import TransactionTestCase\r\n+from django.core.files.uploadedfile import UploadedFile\r\n+from django.contrib.auth.models import Group\r\n+from django.core.exceptions import ValidationError\r\n+from django.db.utils import IntegrityError\r\n+\r\n+from hs_core import hydroshare\r\n+from hs_core.hydroshare import utils\r\n+from hs_core.models import CoreMetaData, Creator, Contributor, Coverage, Rights, Title, Language, \\\r\n+    Publisher, Identifier, Type, Subject, Description, Date, Format, Relation, Source\r\n+from hs_core.testing import MockIRODSTestCaseMixin\r\n+from hs_modflow_modelinstance.models import MODFLOWModelInstanceMetaData, ModelOutput, ExecutedBy, \\\r\n+    StudyArea, GridDimensions, StressPeriod, GroundWaterFlow, BoundaryCondition, ModelCalibration, \\\r\n+    ModelInput, GeneralElements\r\n+\r\n+# cmd to run tests: ./hsctl managepy test --keepdb hs_modflow_modelinstance/tests\r\n+\r\n+\r\n+class TestMODFLOWModelInstanceMetaData(MockIRODSTestCaseMixin, TransactionTestCase):\r\n+    def setUp(self):\r\n+        super(TestMODFLOWModelInstanceMetaData, self).setUp()\r\n+        self.group, _ = Group.objects.get_or_create(name='Hydroshare Author')\r\n+        self.user = hydroshare.create_account(\r\n+            'user1@nowhere.com',\r\n+            username='user1',\r\n+            first_name='Creator_FirstName',\r\n+            last_name='Creator_LastName',\r\n+            superuser=False,\r\n+            groups=[self.group]\r\n+        )\r\n+\r\n+        self.res = hydroshare.create_resource(\r\n+            resource_type='MODFLOWModelInstanceResource',\r\n+            owner=self.user,\r\n+            title='Test MODFLOW Model Instance Resource'\r\n+        )\r\n+\r\n+        self.resGenModelProgram = hydroshare.create_resource(\r\n+            resource_type='ModelProgramResource',\r\n+            owner=self.user,\r\n+            title='Model MODFLOW Program Resource'\r\n+        )\r\n+\r\n+        self.resMODFLOWModelProgram = hydroshare.create_resource(\r\n+            resource_type='ModelProgramResource',\r\n+            owner=self.user,\r\n+            title='Model Program Resource 2'\r\n+        )\r\n+\r\n+        self.temp_dir = tempfile.mkdtemp()\r\n+\r\n+        d = 'hs_modflow_modelinstance/tests/modflow_example/'\r\n+        self.file_list = []\r\n+        self.file_names = []\r\n+        self.sample_nam_name = 'example.nam'\r\n+        self.sample_nam_name2 = 'example2.nam'\r\n+        for file in os.listdir(d):\r\n+            self.file_names.append(file)\r\n+            target_temp_file = os.path.join(self.temp_dir, file)\r\n+            shutil.copy(\"{}{}\".format(d, file), target_temp_file)\r\n+            if self.sample_nam_name == file:\r\n+                self.sample_nam_obj = open(target_temp_file, 'r')\r\n+            elif self.sample_nam_name2 == file:\r\n+                self.sample_nam_obj2 = open(target_temp_file, 'r')\r\n+            else:\r\n+                self.file_list.append(target_temp_file)\r\n+\r\n+        self.file_name = \"MIR.txt\"\r\n+        temp_text_file = os.path.join(self.temp_dir, self.file_name)\r\n+        text_file = open(temp_text_file, 'w')\r\n+        text_file.write(\"Model Instance resource files\")\r\n+        self.text_file_obj = open(temp_text_file, 'r')\r\n+\r\n+    def tearDown(self):\r\n+        super(TestMODFLOWModelInstanceMetaData, self).tearDown()\r\n+        if os.path.exists(self.temp_dir):\r\n+            shutil.rmtree(self.temp_dir)\r\n+\r\n+    def test_allowed_file_types(self):\r\n+        # test allowed file type is '.*'\r\n+        self.assertEquals(self.res.get_supported_upload_file_types(), '.*')\r\n+\r\n+        # there should not be any content file\r\n+        self.assertEquals(self.res.files.all().count(), 0)\r\n+\r\n+        # Upload any file type should pass both the file pre add check post add check\r\n+        files = [UploadedFile(file=self.text_file_obj, name=self.text_file_obj.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+\r\n+        # there should one content file\r\n+        self.assertEquals(self.res.files.all().count(), 1)\r\n+\r\n+        # check that there are no extended metadata elements at this point\r\n+        self.assertEquals(self.res.metadata.model_output, None)\r\n+        self.assertEquals(self.res.metadata.executed_by, None)\r\n+\r\n+        # Upload any other file type should pass both the file pre add check post add check\r\n+        files = [UploadedFile(file=self.text_file_obj, name=self.text_file_obj.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=True)\r\n+\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=True)\r\n+\r\n+        # there should two content files\r\n+        self.assertEquals(self.res.files.all().count(), 2)\r\n+\r\n+        # check that there are no extended metadata elements at this point\r\n+        self.assertEquals(self.res.metadata.model_output, None)\r\n+        self.assertEquals(self.res.metadata.executed_by, None)\r\n+\r\n+    def test_extended_metadata_CRUD(self):\r\n+        # test the core metadata at this point\r\n+        # there should be a title element\r\n+        self.assertEquals(self.res.metadata.title.value, 'Test MODFLOW Model Instance Resource')\r\n+\r\n+        # there should be a creator element\r\n+        self.assertEquals(self.res.metadata.creators.count(), 1)\r\n+\r\n+        # # there should be a type element\r\n+        self.assertNotEqual(self.res.metadata.type, None)\r\n+\r\n+        # there should be an identifier element\r\n+        self.assertEquals(self.res.metadata.identifiers.count(), 1)\r\n+\r\n+        # there should be rights element\r\n+        self.assertNotEqual(self.res.metadata.rights, None)\r\n+\r\n+        # there shouldn't any source element\r\n+        self.assertEquals(self.res.metadata.sources.count(), 0)\r\n+\r\n+        # there shouldn't any relation element\r\n+        self.assertEquals(self.res.metadata.relations.count(), 0)\r\n+\r\n+        # there shouldn't any abstract element\r\n+        self.assertEquals(self.res.metadata.description, None)\r\n+\r\n+        # there shouldn't any coverage element\r\n+        self.assertEquals(self.res.metadata.coverages.all().count(), 0)\r\n+\r\n+        # there shouldn't any format element\r\n+        self.assertEquals(self.res.metadata.formats.all().count(), 0)\r\n+\r\n+        # there shouldn't any subject element\r\n+        self.assertEquals(self.res.metadata.subjects.all().count(), 0)\r\n+\r\n+        # there shouldn't any contributor element\r\n+        self.assertEquals(self.res.metadata.contributors.all().count(), 0)\r\n+\r\n+        # check that there are no extended metadata elements at this point\r\n+        self.assertEquals(self.res.metadata.model_output, None)\r\n+        self.assertEquals(self.res.metadata.executed_by, None)\r\n+        self.assertEquals(self.res.metadata.study_area, None)\r\n+        self.assertEquals(self.res.metadata.grid_dimensions, None)\r\n+        self.assertEquals(self.res.metadata.stress_period, None)\r\n+        self.assertEquals(self.res.metadata.ground_water_flow, None)\r\n+        self.assertEquals(self.res.metadata.boundary_condition, None)\r\n+        self.assertEquals(self.res.metadata.model_calibration, None)\r\n+        self.assertEquals(len(self.res.metadata.model_inputs), 0)\r\n+        self.assertEquals(self.res.metadata.general_elements, None)\r\n+\r\n+        # create\r\n+        # create study_area\r\n+        self.res.metadata.create_element('ModelOutput', includes_output=False)\r\n+        modeloutput_element = self.res.metadata.model_output\r\n+        self.assertEquals(modeloutput_element.includes_output, False)\r\n+        # multiple ModelOutput elements are not allowed - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('ModelOutput', includes_output=True)\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('ModelOutput', includes_output=False)\r\n+        self.res.metadata.delete_element('ModelOutput',\r\n+                                         self.res.metadata.model_output.id)\r\n+        self.assertEqual(self.res.metadata.model_output, None)\r\n+        self.res.metadata.create_element('ModelOutput', includes_output=True)\r\n+        modeloutput_element = self.res.metadata.model_output\r\n+        self.assertEquals(modeloutput_element.includes_output, True)\r\n+        # multiple ModelOutput elements are not allowed - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('ModelOutput', includes_output=True)\r\n+            self.res.metadata.create_element('ModelOutput', includes_output=False)\r\n+\r\n+        # create ExecutedBy\r\n+        self.res.metadata.create_element('ExecutedBy', model_name=self.resGenModelProgram.short_id)\r\n+        modelparam_element = self.res.metadata.executed_by\r\n+        self.assertEquals(modelparam_element.model_name,\r\n+                          self.resGenModelProgram.metadata.title.value)\r\n+        self.assertEquals(modelparam_element.model_program_fk, self.resGenModelProgram)\r\n+        # multiple ExecutedBy elements are not allowed - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('ExecutedBy',\r\n+                                             model_name=self.resMODFLOWModelProgram.short_id)\r\n+\r\n+        # create StudyArea\r\n+        self.res.metadata.create_element('StudyArea',\r\n+                                         totalLength='a',\r\n+                                         totalWidth='b',\r\n+                                         maximumElevation='c',\r\n+                                         minimumElevation='d')\r\n+        modelparam_element = self.res.metadata.study_area\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.totalLength, 'a')\r\n+        self.assertEquals(modelparam_element.totalWidth, 'b')\r\n+        self.assertEquals(modelparam_element.maximumElevation, 'c')\r\n+        self.assertEquals(modelparam_element.minimumElevation, 'd')\r\n+\r\n+        # try to create another studyarea - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('StudyArea',\r\n+                                             totalLength='b',\r\n+                                             totalWidth='c',\r\n+                                             maximumElevation='d',\r\n+                                             minimumElevation='e')\r\n+\r\n+        # create GridDimensions\r\n+        self.res.metadata.create_element('GridDimensions',\r\n+                                         numberOfLayers='a',\r\n+                                         typeOfRows='Regular',\r\n+                                         numberOfRows='c',\r\n+                                         typeOfColumns='Irregular',\r\n+                                         numberOfColumns='e')\r\n+        modelparam_element = self.res.metadata.grid_dimensions\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.numberOfLayers, 'a')\r\n+        self.assertEquals(modelparam_element.typeOfRows, 'Regular')\r\n+        self.assertEquals(modelparam_element.numberOfRows, 'c')\r\n+        self.assertEquals(modelparam_element.typeOfColumns, 'Irregular')\r\n+        self.assertEquals(modelparam_element.numberOfColumns, 'e')\r\n+\r\n+        # try to create another griddimensions - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('GridDimensions',\r\n+                                             numberOfLayers='b',\r\n+                                             typeOfRows='Irregular',\r\n+                                             numberOfRows='c',\r\n+                                             typeOfColumns='Regular',\r\n+                                             numberOfColumns='z')\r\n+        # try with wrong dimension types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GridDimensions',\r\n+                                             numberOfLayers='b',\r\n+                                             typeOfRows='catspajamas',\r\n+                                             numberOfRows='c',\r\n+                                             typeOfColumns='Regular',\r\n+                                             numberOfColumns='z')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GridDimensions',\r\n+                                             numberOfLayers='b',\r\n+                                             typeOfRows='Irregular',\r\n+                                             numberOfRows='c',\r\n+                                             typeOfColumns='beach',\r\n+                                             numberOfColumns='z')\r\n+\r\n+        # create stressperiod\r\n+        self.res.metadata.create_element('StressPeriod',\r\n+                                         stressPeriodType='Steady',\r\n+                                         steadyStateValue='a',\r\n+                                         transientStateValueType='Daily',\r\n+                                         transientStateValue='b')\r\n+        modelparam_element = self.res.metadata.stress_period\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.stressPeriodType, 'Steady')\r\n+        self.assertEquals(modelparam_element.steadyStateValue, 'a')\r\n+        self.assertEquals(modelparam_element.transientStateValueType, 'Daily')\r\n+        self.assertEquals(modelparam_element.transientStateValue, 'b')\r\n+\r\n+        # try to create another stressperiod - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('StressPeriod',\r\n+                                             stressPeriodType='Steady',\r\n+                                             steadyStateValue='a',\r\n+                                             transientStateValueType='Daily',\r\n+                                             transientStateValue='b')\r\n+        # try with wrong stressperiod types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('StressPeriod',\r\n+                                             stressPeriodType='Steady',\r\n+                                             steadyStateValue='a',\r\n+                                             transientStateValueType='Daly',\r\n+                                             transientStateValue='b')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('StressPeriod',\r\n+                                             stressPeriodType='Bready',\r\n+                                             steadyStateValue='a',\r\n+                                             transientStateValueType='Daily',\r\n+                                             transientStateValue='b')\r\n+\r\n+        # create groundwaterflow\r\n+        self.res.metadata.create_element('GroundWaterFlow',\r\n+                                         flowPackage='BCF6',\r\n+                                         flowParameter='Transmissivity')\r\n+        modelparam_element = self.res.metadata.ground_water_flow\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.flowPackage, 'BCF6')\r\n+        self.assertEquals(modelparam_element.flowParameter, 'Transmissivity')\r\n+\r\n+        # try to create another groundwaterflow - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('GroundWaterFlow',\r\n+                                             flowPackage='BCF6',\r\n+                                             flowParameter='Transmissivity')\r\n+        # try with wrong groundwaterflow types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GroundWaterFlow',\r\n+                                             flowPackage='BCFd6',\r\n+                                             flowParameter='Transmissivity')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GroundWaterFlow',\r\n+                                             flowPackage='BCF6',\r\n+                                             flowParameter='Tranasmissivity')\r\n+\r\n+        # create boundary condition\r\n+        # try with wrong boundarycondition types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('BoundaryCondition',\r\n+                                             specified_head_boundary_packages=['BFH'],\r\n+                                             specified_flux_boundary_packages=['FHB'],\r\n+                                             head_dependent_flux_boundary_packages=['mmm'])\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('BoundaryCondition',\r\n+                                             specified_head_boundary_packages=['BFH'],\r\n+                                             specified_flux_boundary_packages=['mmm'],\r\n+                                             head_dependent_flux_boundary_packages=['SFR'])\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('BoundaryCondition',\r\n+                                             specified_head_boundary_packages=['mmm'],\r\n+                                             specified_flux_boundary_packages=['FHB'],\r\n+                                             head_dependent_flux_boundary_packages=['SFR'])\r\n+\r\n+        spec_hd_bd_pkgs = ['CHD', 'FHB']\r\n+        spec_fx_bd_pkgs = ['RCH', 'WEL']\r\n+        hd_dep_fx_pkgs = ['MNW2', 'GHB', 'LAK']\r\n+        self.res.metadata.create_element('BoundaryCondition',\r\n+                                         specified_head_boundary_packages=spec_hd_bd_pkgs,\r\n+                                         specified_flux_boundary_packages=spec_fx_bd_pkgs,\r\n+                                         head_dependent_flux_boundary_packages=hd_dep_fx_pkgs,\r\n+                                         other_specified_head_boundary_packages='JMS',\r\n+                                         other_specified_flux_boundary_packages='MMM',\r\n+                                         other_head_dependent_flux_boundary_packages='JLG')\r\n+        modelparam_element = self.res.metadata.boundary_condition\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+\r\n+        # check specified_head_boundary_packages\r\n+        added_packages = modelparam_element.get_specified_head_boundary_packages()\r\n+        for intended_package in spec_hd_bd_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        # check specified_flux_boundary_packages\r\n+        added_packages = modelparam_element.get_specified_flux_boundary_packages()\r\n+        for intended_package in spec_fx_bd_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        # check head_dependent_flux_boundary_packages\r\n+        added_packages = modelparam_element.get_head_dependent_flux_boundary_packages()\r\n+        for intended_package in hd_dep_fx_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        # check other packages\r\n+        self.assertEquals(modelparam_element.other_specified_head_boundary_packages, 'JMS')\r\n+        self.assertEquals(modelparam_element.other_specified_flux_boundary_packages, 'MMM')\r\n+        self.assertEquals(modelparam_element.other_head_dependent_flux_boundary_packages, 'JLG')\r\n+\r\n+        # try to create another boundarycondition - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('BoundaryCondition',\r\n+                                             specified_head_boundary_packages=spec_hd_bd_pkgs,\r\n+                                             specified_flux_boundary_packages=spec_fx_bd_pkgs,\r\n+                                             head_dependent_flux_boundary_packages=hd_dep_fx_pkgs)\r\n+\r\n+        # create modelcalibration\r\n+        self.res.metadata.create_element('ModelCalibration',\r\n+                                         calibratedParameter='a',\r\n+                                         observationType='b',\r\n+                                         observationProcessPackage='RVOB',\r\n+                                         calibrationMethod='c')\r\n+        modelparam_element = self.res.metadata.model_calibration\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.calibratedParameter, 'a')\r\n+        self.assertEquals(modelparam_element.observationType, 'b')\r\n+        self.assertEquals(modelparam_element.observationProcessPackage, 'RVOB')\r\n+        self.assertEquals(modelparam_element.calibrationMethod, 'c')\r\n+\r\n+        # try to create another modelcalibration - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('ModelCalibration',\r\n+                                             calibratedParameter='aa',\r\n+                                             observationType='b',\r\n+                                             observationProcessPackage='RVOB',\r\n+                                             calibrationMethod='c')\r\n+        # try with wrong modelcalibration types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('ModelCalibration',\r\n+                                             calibratedParameter='a',\r\n+                                             observationType='b',\r\n+                                             observationProcessPackage='RVoB',\r\n+                                             calibrationMethod='c')\r\n+\r\n+        # create ModelInput\r\n+        self.res.metadata.create_element('ModelInput',\r\n+                                         inputType='a',\r\n+                                         inputSourceName='b',\r\n+                                         inputSourceURL='http://www.RVOB.com')\r\n+        modelparam_elements = self.res.metadata.model_inputs\r\n+        self.assertEqual(len(modelparam_elements), 1)\r\n+        modelparam_element = modelparam_elements[0]\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.inputType, 'a')\r\n+        self.assertEquals(modelparam_element.inputSourceName, 'b')\r\n+        self.assertEquals(modelparam_element.inputSourceURL, 'http://www.RVOB.com')\r\n+\r\n+        # create another modelinput\r\n+        self.res.metadata.create_element('ModelInput',\r\n+                                         inputType='aa',\r\n+                                         inputSourceName='bd',\r\n+                                         inputSourceURL='http://www.RVOBs.com')\r\n+        modelparam_elements = self.res.metadata.model_inputs\r\n+        self.assertEqual(len(modelparam_elements), 2)\r\n+        modelparam_element = modelparam_elements[0]\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.inputType, 'aa')\r\n+        self.assertEquals(modelparam_element.inputSourceName, 'bd')\r\n+        self.assertEquals(modelparam_element.inputSourceURL, 'http://www.RVOBs.com')\r\n+\r\n+        # create generalelements\r\n+        # try with wrong generalelements types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GeneralElements',\r\n+                                             modelParameter='BCF6',\r\n+                                             modelSolver='DsE4',\r\n+                                             output_control_package=['LMT6'],\r\n+                                             subsidencePackage='SUB')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GeneralElements',\r\n+                                             modelParameter='BCF6',\r\n+                                             modelSolver='DE4',\r\n+                                             output_control_package=['LMt6'],\r\n+                                             subsidencePackage='SUB')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.create_element('GeneralElements',\r\n+                                             modelParameter='BCF6',\r\n+                                             modelSolver='DE4',\r\n+                                             output_control_package=['LMT6'],\r\n+                                             subsidencePackage='SaUB')\r\n+        ot_ctl_pkgs = ['LMT6', 'OC']\r\n+        self.res.metadata.create_element('GeneralElements',\r\n+                                         modelParameter='BCF6',\r\n+                                         modelSolver='DE4',\r\n+                                         output_control_package=ot_ctl_pkgs,\r\n+                                         subsidencePackage='SUB')\r\n+        modelparam_element = self.res.metadata.general_elements\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.modelParameter, 'BCF6')\r\n+        self.assertEquals(modelparam_element.modelSolver, 'DE4')\r\n+\r\n+        # check outputControlPackage\r\n+        added_packages = modelparam_element.get_output_control_package()\r\n+        for intended_package in ot_ctl_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        self.assertEquals(modelparam_element.subsidencePackage, 'SUB')\r\n+\r\n+        # try to create another generalelements - it would raise an exception\r\n+        with self.assertRaises(IntegrityError):\r\n+            self.res.metadata.create_element('GeneralElements',\r\n+                                             modelParameter='BCF6',\r\n+                                             modelSolver='DE4',\r\n+                                             output_control_package=['LMT6'],\r\n+                                             subsidencePackage='SUB')\r\n+\r\n+        # update\r\n+        # update ModelOutput\r\n+        self.res.metadata.update_element('ModelOutput',\r\n+                                         self.res.metadata.model_output.id,\r\n+                                         includes_output=False)\r\n+        self.assertEquals(self.res.metadata.model_output.includes_output, False)\r\n+        self.res.metadata.update_element('ModelOutput',\r\n+                                         self.res.metadata.model_output.id,\r\n+                                         includes_output=True)\r\n+        self.assertEquals(self.res.metadata.model_output.includes_output, True)\r\n+\r\n+        # update ExecutedBy\r\n+        self.res.metadata.update_element('ExecutedBy',\r\n+                                         self.res.metadata.executed_by.id,\r\n+                                         model_name=self.resMODFLOWModelProgram.short_id)\r\n+        modelparam_element = self.res.metadata.executed_by\r\n+        self.assertEquals(modelparam_element.model_name,\r\n+                          self.resMODFLOWModelProgram.metadata.title.value)\r\n+        self.assertEquals(modelparam_element.model_program_fk, self.resMODFLOWModelProgram)\r\n+\r\n+        # update StudyArea\r\n+        self.res.metadata.update_element('StudyArea',\r\n+                                         self.res.metadata.study_area.id,\r\n+                                         totalLength=33,\r\n+                                         totalWidth=2533,\r\n+                                         maximumElevation=12,\r\n+                                         minimumElevation=-148)\r\n+        modelparam_element = self.res.metadata.study_area\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.totalLength, '33')\r\n+        self.assertEquals(modelparam_element.totalWidth, '2533')\r\n+        self.assertEquals(modelparam_element.maximumElevation, '12')\r\n+        self.assertEquals(modelparam_element.minimumElevation, '-148')\r\n+\r\n+        # update GridDimensions\r\n+        self.res.metadata.update_element('GridDimensions',\r\n+                                         self.res.metadata.grid_dimensions.id,\r\n+                                         numberOfLayers='b',\r\n+                                         typeOfRows='Irregular',\r\n+                                         numberOfRows='d',\r\n+                                         typeOfColumns='Regular',\r\n+                                         numberOfColumns='f')\r\n+        modelparam_element = self.res.metadata.grid_dimensions\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.numberOfLayers, 'b')\r\n+        self.assertEquals(modelparam_element.typeOfRows, 'Irregular')\r\n+        self.assertEquals(modelparam_element.numberOfRows, 'd')\r\n+        self.assertEquals(modelparam_element.typeOfColumns, 'Regular')\r\n+        self.assertEquals(modelparam_element.numberOfColumns, 'f')\r\n+\r\n+        # try with wrong dimension types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata. update_element('GridDimensions',\r\n+                                              self.res.metadata.grid_dimensions.id,\r\n+                                              numberOfLayers='b',\r\n+                                              typeOfRows='catspajamas',\r\n+                                              numberOfRows='c',\r\n+                                              typeOfColumns='Regular',\r\n+                                              numberOfColumns='z')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('GridDimensions',\r\n+                               self.res.metadata.grid_dimensions.id,\r\n+                               numberOfLayers='b',\r\n+                               typeOfRows='Irregular',\r\n+                               numberOfRows='c',\r\n+                               typeOfColumns='beach',\r\n+                               numberOfColumns='z')\r\n+\r\n+        # update stressperiod\r\n+        self.res.metadata.update_element('StressPeriod',\r\n+                                         self.res.metadata.stress_period.id,\r\n+                                         stressPeriodType='Transient',\r\n+                                         steadyStateValue='555',\r\n+                                         transientStateValueType='Annually',\r\n+                                         transientStateValue='123')\r\n+        modelparam_element = self.res.metadata.stress_period\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.stressPeriodType, 'Transient')\r\n+        self.assertEquals(modelparam_element.steadyStateValue, '555')\r\n+        self.assertEquals(modelparam_element.transientStateValueType, 'Annually')\r\n+        self.assertEquals(modelparam_element.transientStateValue, '123')\r\n+\r\n+        # try with wrong stressperiod types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.update_element('StressPeriod',\r\n+                                             self.res.metadata.stress_period.id,\r\n+                                             stressPeriodType='Transsdfasient',\r\n+                                             steadyStateValue='555',\r\n+                                             transientStateValueType='Annually',\r\n+                                             transientStateValue='123')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.update_element('StressPeriod',\r\n+                                             self.res.metadata.stress_period.id,\r\n+                                             stressPeriodType='Transient',\r\n+                                             steadyStateValue='555',\r\n+                                             transientStateValueType='Annfadsfually',\r\n+                                             transientStateValue='123')\r\n+\r\n+        # update groundwaterflow\r\n+        self.res.metadata.update_element('GroundWaterFlow',\r\n+                                         self.res.metadata.ground_water_flow.id,\r\n+                                         flowPackage='UPW',\r\n+                                         flowParameter='Hydraulic Conductivity')\r\n+        modelparam_element = self.res.metadata.ground_water_flow\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.flowPackage, 'UPW')\r\n+        self.assertEquals(modelparam_element.flowParameter, 'Hydraulic Conductivity')\r\n+\r\n+        # try with wrong groundwaterflow types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('GroundWaterFlow',\r\n+                               self.res.metadata.ground_water_flow.id,\r\n+                               flowPackage='UPsW',\r\n+                               flowParameter='Hydraulic Conductivity')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('GroundWaterFlow',\r\n+                               self.res.metadata.ground_water_flow.id,\r\n+                               flowPackage='UPW',\r\n+                               flowParameter='Hydraalic Conductivity')\r\n+\r\n+        # update boundary condition\r\n+        # try with wrong boundarycondition types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('BoundaryCondition',\r\n+                               self.res.metadata.boundary_condition.id,\r\n+                               specified_head_boundary_packages=['BFH'],\r\n+                               specified_flux_boundary_packages=['FHB'],\r\n+                               head_dependent_flux_boundary_packages=['mmm'])\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('BoundaryCondition',\r\n+                               self.res.metadata.boundary_condition.id,\r\n+                               specified_head_boundary_packages=['BFH'],\r\n+                               specified_flux_boundary_packages=['mmm'],\r\n+                               head_dependent_flux_boundary_packages=['SFR'])\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('BoundaryCondition',\r\n+                               self.res.metadata.boundary_condition.id,\r\n+                               specified_head_boundary_packages=['mmm'],\r\n+                               specified_flux_boundary_packages=['FHB'],\r\n+                               head_dependent_flux_boundary_packages=['SFR'])\r\n+\r\n+        spec_hd_bd_pkgs = ['BFH']\r\n+        spec_fx_bd_pkgs = ['FHB']\r\n+        hd_dep_fx_pkgs = ['RIV', 'DAFG', 'DRT']\r\n+        self.res.metadata.\\\r\n+            update_element('BoundaryCondition',\r\n+                           self.res.metadata.boundary_condition.id,\r\n+                           specified_head_boundary_packages=spec_hd_bd_pkgs,\r\n+                           specified_flux_boundary_packages=spec_fx_bd_pkgs,\r\n+                           head_dependent_flux_boundary_packages=hd_dep_fx_pkgs,\r\n+                           other_specified_head_boundary_packages=\"AAA\",\r\n+                           other_specified_flux_boundary_packages=\"BBB\",\r\n+                           other_head_dependent_flux_boundary_packages=\"CCC\")\r\n+        modelparam_element = self.res.metadata.boundary_condition\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+\r\n+        # check specified_head_boundary_packages\r\n+        added_packages = modelparam_element.get_specified_head_boundary_packages()\r\n+        for intended_package in spec_hd_bd_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        # check specified_flux_boundary_packages\r\n+        added_packages = modelparam_element.get_specified_flux_boundary_packages()\r\n+        for intended_package in spec_fx_bd_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        # check head_dependent_flux_boundary_packages\r\n+        added_packages = modelparam_element.get_head_dependent_flux_boundary_packages()\r\n+        for intended_package in hd_dep_fx_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        # check other packages\r\n+        self.assertEquals(modelparam_element.other_specified_head_boundary_packages, 'AAA')\r\n+        self.assertEquals(modelparam_element.other_specified_flux_boundary_packages, 'BBB')\r\n+        self.assertEquals(modelparam_element.other_head_dependent_flux_boundary_packages, 'CCC')\r\n+\r\n+        # update modelcalibration\r\n+        self.res.metadata.update_element('ModelCalibration',\r\n+                                         self.res.metadata.model_calibration.id,\r\n+                                         calibratedParameter='b',\r\n+                                         observationType='c',\r\n+                                         observationProcessPackage='OBS',\r\n+                                         calibrationMethod='d')\r\n+        modelparam_element = self.res.metadata.model_calibration\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.calibratedParameter, 'b')\r\n+        self.assertEquals(modelparam_element.observationType, 'c')\r\n+        self.assertEquals(modelparam_element.observationProcessPackage, 'OBS')\r\n+        self.assertEquals(modelparam_element.calibrationMethod, 'd')\r\n+\r\n+        # try with wrong modelcalibration types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('ModelCalibration',\r\n+                               self.res.metadata.model_calibration.id,\r\n+                               calibratedParameter='a',\r\n+                               observationType='b',\r\n+                               observationProcessPackage='dtarb',\r\n+                               calibrationMethod='c')\r\n+\r\n+        # update ModelInput\r\n+        self.res.metadata.update_element('ModelInput',\r\n+                                         self.res.metadata.model_inputs[1].id,\r\n+                                         inputType='b',\r\n+                                         inputSourceName='c',\r\n+                                         inputSourceURL='http://www.RVOB.com')\r\n+        modelparam_elements = self.res.metadata.model_inputs\r\n+        self.assertEqual(len(modelparam_elements), 2)\r\n+        modelparam_element = modelparam_elements[1]\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.inputType, 'b')\r\n+        self.assertEquals(modelparam_element.inputSourceName, 'c')\r\n+        self.assertEquals(modelparam_element.inputSourceURL, 'http://www.RVOB.com')\r\n+\r\n+        # update another modelinput\r\n+        self.res.metadata.update_element('ModelInput',\r\n+                                         self.res.metadata.model_inputs[0].id,\r\n+                                         inputType='bb',\r\n+                                         inputSourceName='cc',\r\n+                                         inputSourceURL='http://www.RVOBss.com')\r\n+        modelparam_elements = self.res.metadata.model_inputs\r\n+        self.assertEqual(len(modelparam_elements), 2)\r\n+        modelparam_element = modelparam_elements[0]\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.inputType, 'bb')\r\n+        self.assertEquals(modelparam_element.inputSourceName, 'cc')\r\n+        self.assertEquals(modelparam_element.inputSourceURL, 'http://www.RVOBss.com')\r\n+\r\n+        # update generalelements\r\n+        # try with wrong generalelements types - raises exception\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('GeneralElements',\r\n+                               self.res.metadata.general_elements.id,\r\n+                               modelParameter='BCF6',\r\n+                               modelSolver='DsE4',\r\n+                               output_control_package=['LMT6'],\r\n+                               subsidencePackage='SUB')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('GeneralElements',\r\n+                               self.res.metadata.general_elements.id,\r\n+                               modelParameter='BCF6',\r\n+                               modelSolver='DE4',\r\n+                               output_control_package=['LMTd6'],\r\n+                               subsidencePackage='SUB')\r\n+        with self.assertRaises(ValidationError):\r\n+            self.res.metadata.\\\r\n+                update_element('GeneralElements',\r\n+                               self.res.metadata.general_elements.id,\r\n+                               modelParameter='BCF6',\r\n+                               modelSolver='DE4',\r\n+                               output_control_package=['LMT6'],\r\n+                               subsidencePackage='SaUB')\r\n+        ot_ctl_pkgs = ['GAGE', 'MNWI']\r\n+\r\n+        self.res.metadata.update_element('GeneralElements',\r\n+                                         self.res.metadata.general_elements.id,\r\n+                                         modelParameter='hydraulic conductivity',\r\n+                                         modelSolver='PCGN',\r\n+                                         output_control_package=ot_ctl_pkgs,\r\n+                                         subsidencePackage='SWT')\r\n+        modelparam_element = self.res.metadata.general_elements\r\n+        self.assertNotEqual(modelparam_element, None)\r\n+        self.assertEquals(modelparam_element.modelParameter, 'hydraulic conductivity')\r\n+        self.assertEquals(modelparam_element.modelSolver, 'PCGN')\r\n+\r\n+        # check outputControlPackage\r\n+        added_packages = modelparam_element.get_output_control_package()\r\n+        for intended_package in ot_ctl_pkgs:\r\n+            self.assertEquals(intended_package in added_packages, True)\r\n+\r\n+        self.assertEquals(modelparam_element.subsidencePackage, 'SWT')\r\n+\r\n+        # delete\r\n+        # check that there are all extended metadata elements at this point\r\n+        self.assertNotEqual(self.res.metadata.model_output, None)\r\n+        self.assertNotEqual(self.res.metadata.executed_by, None)\r\n+        self.assertNotEqual(self.res.metadata.study_area, None)\r\n+        self.assertNotEqual(self.res.metadata.grid_dimensions, None)\r\n+        self.assertNotEqual(self.res.metadata.stress_period, None)\r\n+        self.assertNotEqual(self.res.metadata.ground_water_flow, None)\r\n+        self.assertNotEqual(self.res.metadata.boundary_condition, None)\r\n+        self.assertNotEqual(self.res.metadata.model_calibration, None)\r\n+        self.assertNotEqual(self.res.metadata.model_inputs, None)\r\n+        self.assertNotEqual(self.res.metadata.general_elements, None)\r\n+\r\n+        # delete all elements\r\n+        self.res.metadata.delete_element('ModelOutput',\r\n+                                         self.res.metadata.model_output.id)\r\n+        self.res.metadata.delete_element('ExecutedBy',\r\n+                                         self.res.metadata.executed_by.id)\r\n+        self.res.metadata.delete_element('StudyArea',\r\n+                                         self.res.metadata.study_area.id)\r\n+        self.res.metadata.delete_element('GridDimensions',\r\n+                                         self.res.metadata.grid_dimensions.id)\r\n+        self.res.metadata.delete_element('StressPeriod',\r\n+                                         self.res.metadata.stress_period.id)\r\n+        self.res.metadata.delete_element('GroundWaterFlow',\r\n+                                         self.res.metadata.ground_water_flow.id)\r\n+        self.res.metadata.\\\r\n+            delete_element('BoundaryCondition', self.res.metadata.boundary_condition.id)\r\n+        self.res.metadata.delete_element('ModelCalibration',\r\n+                                         self.res.metadata.model_calibration.id)\r\n+        for items in range(len(self.res.metadata.model_inputs)):\r\n+            self.res.metadata.\\\r\n+                delete_element('ModelInput', self.res.metadata.model_inputs[0].id)\r\n+        self.res.metadata.delete_element('GeneralElements',\r\n+                                         self.res.metadata.general_elements.id)\r\n+\r\n+        # make sure they are deleted\r\n+        self.assertEqual(self.res.metadata.model_output, None)\r\n+        self.assertEqual(self.res.metadata.executed_by, None)\r\n+        self.assertEqual(self.res.metadata.study_area, None)\r\n+        self.assertEqual(self.res.metadata.grid_dimensions, None)\r\n+        self.assertEqual(self.res.metadata.stress_period, None)\r\n+        self.assertEqual(self.res.metadata.ground_water_flow, None)\r\n+        self.assertEqual(self.res.metadata.boundary_condition, None)\r\n+        self.assertEqual(self.res.metadata.model_calibration, None)\r\n+        self.assertEqual(len(self.res.metadata.model_inputs), 0)\r\n+        self.assertEqual(self.res.metadata.general_elements, None)\r\n+\r\n+    def test_public_or_discoverable(self):\r\n+        self.assertFalse(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.metadata.has_all_required_elements())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # add txt file\r\n+        files = [UploadedFile(file=self.text_file_obj, name=self.text_file_obj.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        self.assertFalse(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # add .nam file\r\n+        files = [UploadedFile(file=self.sample_nam_obj, name=self.sample_nam_obj.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        self.assertFalse(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # add reqd files except 2\r\n+        for f in self.file_list[2:]:\r\n+            self.assertFalse(self.res.has_required_content_files())\r\n+            self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+            f_obj = open(f, 'r')\r\n+            files = [UploadedFile(file=f_obj, name=f_obj.name)]\r\n+            utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                                extract_metadata=False)\r\n+            utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        self.assertFalse(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # add all reqd files\r\n+        for f in self.file_list[:2]:\r\n+            self.assertFalse(self.res.has_required_content_files())\r\n+            self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+            f_obj = open(f, 'r')\r\n+            files = [UploadedFile(file=f_obj, name=f_obj.name)]\r\n+            utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                                extract_metadata=False)\r\n+            utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        self.assertTrue(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # add generically required elements; should be made public\r\n+        self.res.metadata.create_element('Description', abstract=\"test abstract\")\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        self.res.metadata.create_element('Subject', value=\"test subject\")\r\n+        self.assertTrue(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # add another .nam file; should not be able to be public\r\n+        files = [UploadedFile(file=self.sample_nam_obj2, name=self.sample_nam_obj2.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        self.assertFalse(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # delete extra .nam file; should be able to be public again\r\n+        hydroshare.delete_resource_file(self.res.short_id, self.sample_nam_name2, self.user)\r\n+        self.assertTrue(self.res.has_required_content_files())\r\n+        self.assertTrue(self.res.can_be_public_or_discoverable)\r\n+\r\n+        # delete one reqd file; should not be able to be public again\r\n+        hydroshare.delete_resource_file(self.res.short_id, self.file_names[2], self.user)\r\n+        self.assertFalse(self.res.has_required_content_files())\r\n+        self.assertFalse(self.res.can_be_public_or_discoverable)\r\n+\r\n+    def test_multiple_content_files(self):\r\n+        self.assertTrue(self.res.can_have_multiple_files())\r\n+\r\n+    def test_get_xml(self):\r\n+        self.res.metadata.create_element('Description', abstract=\"test abstract\")\r\n+        self.res.metadata.create_element('Subject', value=\"test subject\")\r\n+        self.res.metadata.create_element('ModelOutput', includes_output=True)\r\n+        self.res.metadata.create_element('ExecutedBy', model_name=self.resGenModelProgram.short_id)\r\n+        self.res.metadata.create_element('StudyArea',\r\n+                                         totalLength=1111,\r\n+                                         totalWidth=2222,\r\n+                                         maximumElevation=3333,\r\n+                                         minimumElevation=4444)\r\n+        self.res.metadata.create_element('GridDimensions',\r\n+                                         numberOfLayers=5555,\r\n+                                         typeOfRows='Irregular',\r\n+                                         numberOfRows=6666,\r\n+                                         typeOfColumns='Regular',\r\n+                                         numberOfColumns=7777)\r\n+        self.res.metadata.create_element('StressPeriod',\r\n+                                         stressPeriodType='Steady and Transient',\r\n+                                         steadyStateValue=8888,\r\n+                                         transientStateValueType='Monthly',\r\n+                                         transientStateValue=9999)\r\n+        self.res.metadata.create_element('GroundwaterFlow',\r\n+                                         flowPackage='LPF',\r\n+                                         flowParameter='Hydraulic Conductivity')\r\n+        self.res.metadata.create_element('BoundaryCondition',\r\n+                                         specified_head_boundary_packages=['CHD', 'FHB'],\r\n+                                         specified_flux_boundary_packages=['FHB', 'WEL'],\r\n+                                         head_dependent_flux_boundary_packages=['RIV', 'MNW1'])\r\n+        self.res.metadata.create_element('ModelCalibration',\r\n+                                         calibratedParameter='test parameter',\r\n+                                         observationType='test observation type',\r\n+                                         observationProcessPackage='GBOB',\r\n+                                         calibrationMethod='test calibration method')\r\n+        self.res.metadata.create_element('ModelInput',\r\n+                                         inputType='test input type',\r\n+                                         inputSourceName='test source name',\r\n+                                         inputSourceURL='http://www.test.com')\r\n+        self.res.metadata.create_element('GeneralElements',\r\n+                                         modelParameter='test model parameter',\r\n+                                         modelSolver='SIP',\r\n+                                         output_control_package=['HYD', 'OC'],\r\n+                                         subsidencePackage='SWT')\r\n+        xml_doc = self.res.metadata.get_xml()\r\n+        # check to see if the specific metadata are in the xml doc\r\n+        self.assertTrue('1111' in xml_doc)\r\n+        self.assertTrue('2222' in xml_doc)\r\n+        self.assertTrue('3333' in xml_doc)\r\n+        self.assertTrue('4444' in xml_doc)\r\n+        self.assertTrue('5555' in xml_doc)\r\n+        self.assertTrue('Irregular' in xml_doc)\r\n+        self.assertTrue('6666' in xml_doc)\r\n+        self.assertTrue('Regular' in xml_doc)\r\n+        self.assertTrue('7777' in xml_doc)\r\n+        self.assertTrue('Steady and Transient' in xml_doc)\r\n+        self.assertTrue('8888' in xml_doc)\r\n+        self.assertTrue('Monthly' in xml_doc)\r\n+        self.assertTrue('9999' in xml_doc)\r\n+        self.assertTrue('LPF' in xml_doc)\r\n+        self.assertTrue('Hydraulic Conductivity' in xml_doc)\r\n+        self.assertTrue('CHD' in xml_doc)\r\n+        self.assertTrue('FHB' in xml_doc)\r\n+        self.assertTrue('FHB' in xml_doc)\r\n+        self.assertTrue('WEL' in xml_doc)\r\n+        self.assertTrue('RIV' in xml_doc)\r\n+        self.assertTrue('MNW1' in xml_doc)\r\n+        self.assertTrue('test parameter' in xml_doc)\r\n+        self.assertTrue('test observation type' in xml_doc)\r\n+        self.assertTrue('GBOB' in xml_doc)\r\n+        self.assertTrue('test calibration method' in xml_doc)\r\n+        self.assertTrue('test input type' in xml_doc)\r\n+        self.assertTrue('test source name' in xml_doc)\r\n+        self.assertTrue('http://www.test.com' in xml_doc)\r\n+        self.assertTrue('test model parameter' in xml_doc)\r\n+        self.assertTrue('SIP' in xml_doc)\r\n+        self.assertTrue('HYD' in xml_doc)\r\n+        self.assertTrue('OC' in xml_doc)\r\n+        self.assertTrue('SWT' in xml_doc)\r\n+\r\n+    def test_metadata_on_content_file_delete(self):\r\n+        # Metadata should remain after content file deletion\r\n+\r\n+        # upload files\r\n+        files = [UploadedFile(file=self.sample_nam_obj, name=self.sample_nam_obj.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        files = [UploadedFile(file=self.sample_nam_obj2, name=self.sample_nam_obj2.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        for f in self.file_list:\r\n+            f_obj = open(f, 'r')\r\n+            files = [UploadedFile(file=f_obj, name=f_obj.name)]\r\n+            utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                                extract_metadata=False)\r\n+            utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+\r\n+        # create metadata elements\r\n+        self.res.metadata.create_element('Description', abstract=\"test abstract\")\r\n+        self.res.metadata.create_element('Subject', value=\"test subject\")\r\n+        self.res.metadata.create_element('ModelOutput', includes_output=True)\r\n+        self.res.metadata.create_element('ExecutedBy', model_name=self.resGenModelProgram.short_id)\r\n+        self.res.metadata.create_element('StudyArea',\r\n+                                         totalLength=1111,\r\n+                                         totalWidth=2222,\r\n+                                         maximumElevation=3333,\r\n+                                         minimumElevation=4444)\r\n+        self.res.metadata.create_element('GridDimensions',\r\n+                                         numberOfLayers=5555,\r\n+                                         typeOfRows='Irregular',\r\n+                                         numberOfRows=6666,\r\n+                                         typeOfColumns='Regular',\r\n+                                         numberOfColumns=7777)\r\n+        self.res.metadata.create_element('StressPeriod',\r\n+                                         stressPeriodType='Steady and Transient',\r\n+                                         steadyStateValue=8888,\r\n+                                         transientStateValueType='Monthly',\r\n+                                         transientStateValue=9999)\r\n+        self.res.metadata.create_element('GroundwaterFlow',\r\n+                                         flowPackage='LPF',\r\n+                                         flowParameter='Hydraulic Conductivity')\r\n+        self.res.metadata.create_element('BoundaryCondition',\r\n+                                         specified_head_boundary_packages=['CHD', 'FHB'],\r\n+                                         specified_flux_boundary_packages=['FHB', 'WEL'],\r\n+                                         head_dependent_flux_boundary_packages=['RIV', 'MNW1'])\r\n+        self.res.metadata.create_element('ModelCalibration',\r\n+                                         calibratedParameter='test parameter',\r\n+                                         observationType='test observation type',\r\n+                                         observationProcessPackage='GBOB',\r\n+                                         calibrationMethod='test calibration method')\r\n+        self.res.metadata.create_element('ModelInput',\r\n+                                         inputType='test input type',\r\n+                                         inputSourceName='test source name',\r\n+                                         inputSourceURL='http://www.test.com')\r\n+        self.res.metadata.create_element('GeneralElements',\r\n+                                         modelParameter='test model parameter',\r\n+                                         modelSolver='SIP',\r\n+                                         output_control_package=['HYD', 'OC'],\r\n+                                         subsidencePackage='SWT')\r\n+\r\n+        # there should 12 content file\r\n+        self.assertEquals(self.res.files.all().count(), 12)\r\n+\r\n+        # there should be 11 format elements (2 nam)\r\n+        self.assertEquals(self.res.metadata.formats.all().count(), 11)\r\n+\r\n+        # delete content files that we added above\r\n+        for f in self.file_names:\r\n+            hydroshare.delete_resource_file(self.res.short_id, f, self.user)\r\n+\r\n+        # there should no content file\r\n+        self.assertEquals(self.res.files.all().count(), 0)\r\n+\r\n+        # there should be no format element\r\n+        self.assertEquals(self.res.metadata.formats.all().count(), 0)\r\n+\r\n+        # test the core metadata at this point\r\n+        self.assertNotEquals(self.res.metadata.title, None)\r\n+\r\n+        # there should be an abstract element\r\n+        self.assertNotEquals(self.res.metadata.description, None)\r\n+\r\n+        # there should be one creator element\r\n+        self.assertEquals(self.res.metadata.creators.all().count(), 1)\r\n+\r\n+        # testing extended metadata elements\r\n+        self.assertNotEqual(self.res.metadata.model_output, None)\r\n+        self.assertNotEqual(self.res.metadata.executed_by, None)\r\n+        self.assertNotEqual(self.res.metadata.study_area, None)\r\n+        self.assertNotEqual(self.res.metadata.grid_dimensions, None)\r\n+        self.assertNotEqual(self.res.metadata.stress_period, None)\r\n+        self.assertNotEqual(self.res.metadata.ground_water_flow, None)\r\n+        self.assertNotEqual(self.res.metadata.boundary_condition, None)\r\n+        self.assertNotEqual(self.res.metadata.model_calibration, None)\r\n+        self.assertNotEqual(self.res.metadata.model_inputs, None)\r\n+        self.assertNotEqual(self.res.metadata.general_elements, None)\r\n+\r\n+    def test_metadata_delete_on_resource_delete(self):\r\n+        # upload files\r\n+        files = [UploadedFile(file=self.sample_nam_obj, name=self.sample_nam_obj.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        files = [UploadedFile(file=self.sample_nam_obj2, name=self.sample_nam_obj2.name)]\r\n+        utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+        utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                        extract_metadata=False)\r\n+        for f in self.file_list:\r\n+            f_obj = open(f, 'r')\r\n+            files = [UploadedFile(file=f_obj, name=f_obj.name)]\r\n+            utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,\r\n+                                                extract_metadata=False)\r\n+            utils.resource_file_add_process(resource=self.res, files=files, user=self.user,\r\n+                                            extract_metadata=False)\r\n+\r\n+        # create metadata elements\r\n+        self.res.metadata.create_element('Description', abstract=\"test abstract\")\r\n+        self.res.metadata.create_element('Subject', value=\"test subject\")\r\n+        self.res.metadata.create_element('ModelOutput', includes_output=True)\r\n+        self.res.metadata.create_element('ExecutedBy', model_name=self.resGenModelProgram.short_id)\r\n+        self.res.metadata.create_element('StudyArea',\r\n+                                         totalLength=1111,\r\n+                                         totalWidth=2222,\r\n+                                         maximumElevation=3333,\r\n+                                         minimumElevation=4444)\r\n+        self.res.metadata.create_element('GridDimensions',\r\n+                                         numberOfLayers=5555,\r\n+                                         typeOfRows='Irregular',\r\n+                                         numberOfRows=6666,\r\n+                                         typeOfColumns='Regular',\r\n+                                         numberOfColumns=7777)\r\n+        self.res.metadata.create_element('StressPeriod',\r\n+                                         stressPeriodType='Steady and Transient',\r\n+                                         steadyStateValue=8888,\r\n+                                         transientStateValueType='Monthly',\r\n+                                         transientStateValue=9999)\r\n+        self.res.metadata.create_element('GroundwaterFlow',\r\n+                                         flowPackage='LPF',\r\n+                                         flowParameter='Hydraulic Conductivity')\r\n+        self.res.metadata.create_element('BoundaryCondition',\r\n+                                         specified_head_boundary_packages=['CHD', 'FHB'],\r\n+                                         specified_flux_boundary_packages=['FHB', 'WEL'],\r\n+                                         head_dependent_flux_boundary_packages=['RIV', 'MNW1'])\r\n+        self.res.metadata.create_element('ModelCalibration',\r\n+                                         calibratedParameter='test parameter',\r\n+                                         observationType='test observation type',\r\n+                                         observationProcessPackage='GBOB',\r\n+                                         calibrationMethod='test calibration method')\r\n+        self.res.metadata.create_element('ModelInput',\r\n+                                         inputType='test inp","path":"hs_modflow_modelinstance/tests/test_modflow_modelinstance_metadata.py","position":null,"original_position":1224,"commit_id":"06b54bab1592b86a6c35fbee07205db9d40a3cca","original_commit_id":"06b54bab1592b86a6c35fbee07205db9d40a3cca","user":{"login":"pkdash","id":2523434,"avatar_url":"https://avatars.githubusercontent.com/u/2523434?v=3","gravatar_id":"","url":"https://api.github.com/users/pkdash","html_url":"https://github.com/pkdash","followers_url":"https://api.github.com/users/pkdash/followers","following_url":"https://api.github.com/users/pkdash/following{/other_user}","gists_url":"https://api.github.com/users/pkdash/gists{/gist_id}","starred_url":"https://api.github.com/users/pkdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkdash/subscriptions","organizations_url":"https://api.github.com/users/pkdash/orgs","repos_url":"https://api.github.com/users/pkdash/repos","events_url":"https://api.github.com/users/pkdash/events{/privacy}","received_events_url":"https://api.github.com/users/pkdash/received_events","type":"User","site_admin":false},"body":"Same as above.","created_at":"2016-07-12T21:33:02Z","updated_at":"2016-07-12T21:33:02Z","html_url":"https://github.com/hydroshare/hydroshare/pull/1329#discussion_r70526657","pull_request_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329","_links":{"self":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments/70526657"},"html":{"href":"https://github.com/hydroshare/hydroshare/pull/1329#discussion_r70526657"},"pull_request":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329"}}},"pull_request":{"url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329","id":76817473,"html_url":"https://github.com/hydroshare/hydroshare/pull/1329","diff_url":"https://github.com/hydroshare/hydroshare/pull/1329.diff","patch_url":"https://github.com/hydroshare/hydroshare/pull/1329.patch","issue_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/1329","number":1329,"state":"open","locked":false,"title":"850 modflow model instance","user":{"login":"jsadler2","id":6943441,"avatar_url":"https://avatars.githubusercontent.com/u/6943441?v=3","gravatar_id":"","url":"https://api.github.com/users/jsadler2","html_url":"https://github.com/jsadler2","followers_url":"https://api.github.com/users/jsadler2/followers","following_url":"https://api.github.com/users/jsadler2/following{/other_user}","gists_url":"https://api.github.com/users/jsadler2/gists{/gist_id}","starred_url":"https://api.github.com/users/jsadler2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsadler2/subscriptions","organizations_url":"https://api.github.com/users/jsadler2/orgs","repos_url":"https://api.github.com/users/jsadler2/repos","events_url":"https://api.github.com/users/jsadler2/events{/privacy}","received_events_url":"https://api.github.com/users/jsadler2/received_events","type":"User","site_admin":false},"body":"@pkdash could you please review this? Ideally we could get this pulled and on www by the CUAHSI bienniel.","created_at":"2016-07-08T21:32:55Z","updated_at":"2016-07-12T21:33:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38f74e50d1ecfb682b9c918f0dafe707658bc3db","assignee":{"login":"pkdash","id":2523434,"avatar_url":"https://avatars.githubusercontent.com/u/2523434?v=3","gravatar_id":"","url":"https://api.github.com/users/pkdash","html_url":"https://github.com/pkdash","followers_url":"https://api.github.com/users/pkdash/followers","following_url":"https://api.github.com/users/pkdash/following{/other_user}","gists_url":"https://api.github.com/users/pkdash/gists{/gist_id}","starred_url":"https://api.github.com/users/pkdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkdash/subscriptions","organizations_url":"https://api.github.com/users/pkdash/orgs","repos_url":"https://api.github.com/users/pkdash/repos","events_url":"https://api.github.com/users/pkdash/events{/privacy}","received_events_url":"https://api.github.com/users/pkdash/received_events","type":"User","site_admin":false},"assignees":[{"login":"pkdash","id":2523434,"avatar_url":"https://avatars.githubusercontent.com/u/2523434?v=3","gravatar_id":"","url":"https://api.github.com/users/pkdash","html_url":"https://github.com/pkdash","followers_url":"https://api.github.com/users/pkdash/followers","following_url":"https://api.github.com/users/pkdash/following{/other_user}","gists_url":"https://api.github.com/users/pkdash/gists{/gist_id}","starred_url":"https://api.github.com/users/pkdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkdash/subscriptions","organizations_url":"https://api.github.com/users/pkdash/orgs","repos_url":"https://api.github.com/users/pkdash/repos","events_url":"https://api.github.com/users/pkdash/events{/privacy}","received_events_url":"https://api.github.com/users/pkdash/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329/commits","review_comments_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329/comments","review_comment_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/1329/comments","statuses_url":"https://api.github.com/repos/hydroshare/hydroshare/statuses/06b54bab1592b86a6c35fbee07205db9d40a3cca","head":{"label":"hydroshare:850-modflow-model-instance","ref":"850-modflow-model-instance","sha":"06b54bab1592b86a6c35fbee07205db9d40a3cca","user":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"repo":{"id":24703136,"name":"hydroshare","full_name":"hydroshare/hydroshare","owner":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hydroshare/hydroshare","description":"HydroShare is a collaborative website being developed for better access to data and models in the hydrologic sciences. ","fork":false,"url":"https://api.github.com/repos/hydroshare/hydroshare","forks_url":"https://api.github.com/repos/hydroshare/hydroshare/forks","keys_url":"https://api.github.com/repos/hydroshare/hydroshare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hydroshare/hydroshare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hydroshare/hydroshare/teams","hooks_url":"https://api.github.com/repos/hydroshare/hydroshare/hooks","issue_events_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/events{/number}","events_url":"https://api.github.com/repos/hydroshare/hydroshare/events","assignees_url":"https://api.github.com/repos/hydroshare/hydroshare/assignees{/user}","branches_url":"https://api.github.com/repos/hydroshare/hydroshare/branches{/branch}","tags_url":"https://api.github.com/repos/hydroshare/hydroshare/tags","blobs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hydroshare/hydroshare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/refs{/sha}","trees_url":"https://api.github.com/repos/hydroshare/hydroshare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hydroshare/hydroshare/statuses/{sha}","languages_url":"https://api.github.com/repos/hydroshare/hydroshare/languages","stargazers_url":"https://api.github.com/repos/hydroshare/hydroshare/stargazers","contributors_url":"https://api.github.com/repos/hydroshare/hydroshare/contributors","subscribers_url":"https://api.github.com/repos/hydroshare/hydroshare/subscribers","subscription_url":"https://api.github.com/repos/hydroshare/hydroshare/subscription","commits_url":"https://api.github.com/repos/hydroshare/hydroshare/commits{/sha}","git_commits_url":"https://api.github.com/repos/hydroshare/hydroshare/git/commits{/sha}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/comments{/number}","issue_comment_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/comments{/number}","contents_url":"https://api.github.com/repos/hydroshare/hydroshare/contents/{+path}","compare_url":"https://api.github.com/repos/hydroshare/hydroshare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hydroshare/hydroshare/merges","archive_url":"https://api.github.com/repos/hydroshare/hydroshare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hydroshare/hydroshare/downloads","issues_url":"https://api.github.com/repos/hydroshare/hydroshare/issues{/number}","pulls_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls{/number}","milestones_url":"https://api.github.com/repos/hydroshare/hydroshare/milestones{/number}","notifications_url":"https://api.github.com/repos/hydroshare/hydroshare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hydroshare/hydroshare/labels{/name}","releases_url":"https://api.github.com/repos/hydroshare/hydroshare/releases{/id}","deployments_url":"https://api.github.com/repos/hydroshare/hydroshare/deployments","created_at":"2014-10-02T02:19:41Z","updated_at":"2016-07-04T04:25:39Z","pushed_at":"2016-07-12T20:35:16Z","git_url":"git://github.com/hydroshare/hydroshare.git","ssh_url":"git@github.com:hydroshare/hydroshare.git","clone_url":"https://github.com/hydroshare/hydroshare.git","svn_url":"https://github.com/hydroshare/hydroshare","homepage":"https://www.hydroshare.org","size":84131,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":226,"forks":2,"open_issues":226,"watchers":16,"default_branch":"develop"}},"base":{"label":"hydroshare:develop","ref":"develop","sha":"ea5d88decd8492e770712ecf70442751a6a5c879","user":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"repo":{"id":24703136,"name":"hydroshare","full_name":"hydroshare/hydroshare","owner":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hydroshare/hydroshare","description":"HydroShare is a collaborative website being developed for better access to data and models in the hydrologic sciences. ","fork":false,"url":"https://api.github.com/repos/hydroshare/hydroshare","forks_url":"https://api.github.com/repos/hydroshare/hydroshare/forks","keys_url":"https://api.github.com/repos/hydroshare/hydroshare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hydroshare/hydroshare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hydroshare/hydroshare/teams","hooks_url":"https://api.github.com/repos/hydroshare/hydroshare/hooks","issue_events_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/events{/number}","events_url":"https://api.github.com/repos/hydroshare/hydroshare/events","assignees_url":"https://api.github.com/repos/hydroshare/hydroshare/assignees{/user}","branches_url":"https://api.github.com/repos/hydroshare/hydroshare/branches{/branch}","tags_url":"https://api.github.com/repos/hydroshare/hydroshare/tags","blobs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hydroshare/hydroshare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/refs{/sha}","trees_url":"https://api.github.com/repos/hydroshare/hydroshare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hydroshare/hydroshare/statuses/{sha}","languages_url":"https://api.github.com/repos/hydroshare/hydroshare/languages","stargazers_url":"https://api.github.com/repos/hydroshare/hydroshare/stargazers","contributors_url":"https://api.github.com/repos/hydroshare/hydroshare/contributors","subscribers_url":"https://api.github.com/repos/hydroshare/hydroshare/subscribers","subscription_url":"https://api.github.com/repos/hydroshare/hydroshare/subscription","commits_url":"https://api.github.com/repos/hydroshare/hydroshare/commits{/sha}","git_commits_url":"https://api.github.com/repos/hydroshare/hydroshare/git/commits{/sha}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/comments{/number}","issue_comment_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/comments{/number}","contents_url":"https://api.github.com/repos/hydroshare/hydroshare/contents/{+path}","compare_url":"https://api.github.com/repos/hydroshare/hydroshare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hydroshare/hydroshare/merges","archive_url":"https://api.github.com/repos/hydroshare/hydroshare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hydroshare/hydroshare/downloads","issues_url":"https://api.github.com/repos/hydroshare/hydroshare/issues{/number}","pulls_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls{/number}","milestones_url":"https://api.github.com/repos/hydroshare/hydroshare/milestones{/number}","notifications_url":"https://api.github.com/repos/hydroshare/hydroshare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hydroshare/hydroshare/labels{/name}","releases_url":"https://api.github.com/repos/hydroshare/hydroshare/releases{/id}","deployments_url":"https://api.github.com/repos/hydroshare/hydroshare/deployments","created_at":"2014-10-02T02:19:41Z","updated_at":"2016-07-04T04:25:39Z","pushed_at":"2016-07-12T20:35:16Z","git_url":"git://github.com/hydroshare/hydroshare.git","ssh_url":"git@github.com:hydroshare/hydroshare.git","clone_url":"https://github.com/hydroshare/hydroshare.git","svn_url":"https://github.com/hydroshare/hydroshare","homepage":"https://www.hydroshare.org","size":84131,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":226,"forks":2,"open_issues":226,"watchers":16,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329"},"html":{"href":"https://github.com/hydroshare/hydroshare/pull/1329"},"issue":{"href":"https://api.github.com/repos/hydroshare/hydroshare/issues/1329"},"comments":{"href":"https://api.github.com/repos/hydroshare/hydroshare/issues/1329/comments"},"review_comments":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329/comments"},"review_comment":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/1329/commits"},"statuses":{"href":"https://api.github.com/repos/hydroshare/hydroshare/statuses/06b54bab1592b86a6c35fbee07205db9d40a3cca"}}}}
{"actor":{"display_login":"pkdash"}}