def test_shp_to_xml_validation(self):
        """
        """
        # Build shapefiles
        gem_unlink("dummy1.xml")
        gem_rmtree("source_shp")
        os.mkdir("source_shp")

        gem_run_script(self.prog, [
            "--input-nrml-file",
            self.input_file,
            "--output-file",
            os.path.join("source_shp", "src_model_files"),
            "--validate"])

        # Run test for all shapefiles
        point_file = os.path.join("source_shp", "src_model_files" + "_point")
        area_file = os.path.join("source_shp", "src_model_files" + "_area")
        simple_file = os.path.join("source_shp", "src_model_files" + "_simple")
        complex_file = os.path.join("source_shp",
                                    "src_model_files" + "_complex")
        gem_run_script(self.prog, ["--input-shp-files",
                                   point_file,
                                   area_file,
                                   simple_file,
                                   complex_file,
                                   "--output-file",
                                   "dummy1.xml",
                                   "--validate"])
        # cleanup
        gem_unlink("dummy1.xml", True)
        gem_rmtree("source_shp", True)
    def test_uhs_converter_wo_plotting(self):
        """
        Tests the execution without plotting
        """
        gem_unlink("dummy_uhs.csv")

        gem_run_script(self.prog, ["--input-file", self.input_file,
                                   "--output-file", "dummy_uhs"])

        # Cleanup
        gem_unlink("dummy_uhs.csv", True)
 def test_hazard_map_converter(self):
     """
     Tests the hazard map converter
     """
     gem_unlink("dummy_hazard_map.csv")
     gem_run_script(self.prog, ["--input-file",
                                self.input_file,
                                "--output-file",
                                "dummy_hazard_map"])
     # Cleanup
     gem_unlink("dummy_hazard_map.csv", True)
    def test_wo_plotting(self):
        """
        Tests the execution without plotting
        """
        gem_unlink("dummy_hazard_curve.csv")

        gem_run_script(self.prog, ["--input-file",
                                   self.input_file,
                                   "--output-file",
                                   "dummy_hazard_curve"])

        # Cleanup
        gem_unlink("dummy_hazard_curve.csv", True)
    def test_disaggregation_converter(self):
        """
        Tests the execution of the disaggregation converter
        """
        gem_rmtree("dummy_disag")

        gem_run_script(self.prog, ["--input-file",
                                   self.input_file,
                                   "--output-dir",
                                   "dummy_disag"])

        # Cleanup
        gem_rmtree("dummy_disag", True)
    def test_gmf_set_converter(self):
        """
        Tests the execution of the gmf set converter
        """
        gem_rmtree("dummy_event_set")

        gem_run_script(self.prog, ["--input-file",
                                   self.input_file,
                                   "--output-dir",
                                   "dummy_event_set"])

        # Cleanup
        gem_rmtree("dummy_event_set", True)
    def test_gmf_scenario_converter(self):
        """
        Tests scenario gmf execution
        """
        gem_rmtree("dummy_scenario_gmf")

        gem_run_script(self.prog, ["--input-file",
                                   self.input_file,
                                   "--output-dir",
                                   "dummy_scenario_gmf"])

        # Cleanup
        gem_rmtree("dummy_scenario_gmf", True)
    def test_csv_to_xml(self):
        """

        """
        gem_unlink("dummy_site.xml")
        input_file = os.path.join(os.path.dirname(__file__),
                                  "..", "sample_data",
                                  "sample_site_model.csv")
        gem_run_script(self.prog, ["--input-csv-file",
                                   input_file,
                                   "--output-xml-file",
                                   "dummy_site.xml"])
        # cleanup
        gem_unlink("dummy_site.xml", True)
 def test_xml_to_shp_with_validation(self):
     """
     Tests the conversion to shapefile - with validation
     """
     #output_dir = os.path.join(os.path.dirname(__file__), "outputs")
     gem_rmtree("source_shp")
     os.mkdir("source_shp")
     gem_run_script(self.prog, [
         "--input-nrml-file",
         self.input_file,
         "--output-file",
         os.path.join("source_shp", "src_model_files"),
         "--validate"])
     # Cleanup
     gem_rmtree("source_shp", True)