Example #1
0
 def test_e2e_noresults(self, records_ids):
     exporter = XunitExport("5_8_0_17",
                            records_ids,
                            self.config_prop,
                            transform_func=lambda arg: None)
     with pytest.raises(NothingToDoException) as excinfo:
         exporter.export()
     assert "Nothing to export" in str(excinfo.value)
Example #2
0
 def test_properties_invalid_lookup(self, records_ids):
     new_config = copy.deepcopy(self.config_prop)
     new_config["xunit_import_properties"][
         "polarion-lookup-method"] = "invalid"
     exporter = XunitExport("5_8_0_17", records_ids, new_config)
     with pytest.raises(Dump2PolarionException) as excinfo:
         exporter.export()
     assert "Invalid value 'invalid' for the 'polarion-lookup-method'" in str(
         excinfo.value)
 def test_e2e_ids_search_transform(self, config_prop, records_json_search):
     exporter = XunitExport("5_8_0_17", records_json_search, config_prop)
     complete = exporter.export()
     fname = "ostriz_search_transform.xml"
     with io.open(os.path.join(conf.DATA_PATH, fname), encoding="utf-8") as input_xml:
         parsed = input_xml.read()
     assert complete == parsed
 def test_e2e_names_transform(self, config_cloudtp, records_names):
     exporter = XunitExport("5_8_0_17", records_names, config_cloudtp)
     complete = exporter.export()
     fname = "complete_parametrization.xml"
     with open(os.path.join(conf.DATA_PATH, fname),
               encoding="utf-8") as input_xml:
         parsed = input_xml.read()
     assert complete == parsed
Example #5
0
 def test_e2e_names_transform(self, records_names):
     exporter = XunitExport("5_8_0_17", records_names, self.config_prop)
     complete = exporter.export()
     fname = "complete_transform_name.xml"
     with io.open(os.path.join(conf.DATA_PATH, fname),
                  encoding="utf-8") as input_xml:
         parsed = input_xml.read()
     assert complete == parsed
 def test_e2e_all_ignored(self, captured_log):
     new_records = ImportedData(
         results=[{
             "title": "foo",
             "id": "foo",
             "verdict": "waiting",
             "ignored": True
         }],
         testrun=None,
     )
     exporter = XunitExport("5_8_0_17",
                            new_records,
                            self.config_prop,
                            transform_func=lambda arg: arg)
     with pytest.raises(NothingToDoException) as excinfo:
         exporter.export()
     assert "Nothing to export" in str(excinfo.value)
     assert "Skipping ignored testcase" in captured_log.getvalue()
Example #7
0
 def test_e2e_ids_notransform(self, config_prop, records_json):
     exporter = XunitExport("5_8_0_17",
                            records_json,
                            config_prop,
                            transform_func=lambda arg: arg)
     complete = exporter.export()
     fname = "ostriz_notransform.xml"
     with open(os.path.join(conf.DATA_PATH, fname),
               encoding="utf-8") as input_xml:
         parsed = input_xml.read()
     assert complete == parsed
    def test_e2e_ok(self, config_prop, tmpdir):
        input_file = os.path.join(conf.DATA_PATH, "workitems_ids.csv")
        db_file = os.path.join(str(tmpdir), "workitems_copy.sqlite3")
        args = ["-i", input_file, "-o", db_file]
        with patch("dump2polarion.csv2sqlite_cli.utils.init_log"):
            retval = csv2sqlite_cli.main(args)
        assert retval == 0

        records = dbtools.import_sqlite(db_file)
        exporter = XunitExport("5_8_0_17", records, config_prop)
        complete = exporter.export()
        fname = "complete_transform.xml"
        with io.open(os.path.join(conf.DATA_PATH, fname), encoding="utf-8") as input_xml:
            parsed = input_xml.read()
        assert complete == parsed