Ejemplo n.º 1
0
 def test_remote_json(self, records_json):
     json_file = os.path.join(conf.DATA_PATH, "ostriz.json")
     with io.open(json_file, encoding="utf-8") as input_json:
         parsed = input_json.read()
     retval = Mock()
     retval.text = parsed
     with patch("requests.get", return_value=retval):
         loaded_json = ostriztools.import_ostriz("https://foo")
     assert loaded_json == records_json
Ejemplo n.º 2
0
 def test_no_json(self):
     with pytest.raises(Dump2PolarionException) as excinfo:
         ostriztools.import_ostriz("NONEXISTENT.json")
     assert "Invalid location" in str(excinfo.value)
Ejemplo n.º 3
0
 def test_invalid_json(self):
     fname = "junit-report.xml"
     with pytest.raises(Dump2PolarionException) as excinfo:
         ostriztools.import_ostriz(os.path.join(conf.DATA_PATH, fname))
     assert "Failed to parse JSON" in str(excinfo.value)
Ejemplo n.º 4
0
 def test_remote_invalid_json(self):
     with patch("requests.get", return_value=False):
         with pytest.raises(Dump2PolarionException) as excinfo:
             ostriztools.import_ostriz("https://foo")
     assert "Failed to parse JSON" in str(excinfo.value)
Ejemplo n.º 5
0
def records_json_search():
    json_file = os.path.join(conf.DATA_PATH, "ostriz_search.json")
    return ostriztools.import_ostriz(json_file)