예제 #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
예제 #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)
예제 #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)
예제 #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)
예제 #5
0
def records_json_search():
    json_file = os.path.join(conf.DATA_PATH, 'ostriz_search.json')
    return ostriztools.import_ostriz(json_file)