Esempio n. 1
0
def error():
    with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_error.json'), 'r') as error_file:
        error_data = error_file.read().replace('\n', '')
    assert error_data is not None
    error: str = str_to_error(error_data)
    yield error
    del error, error_data
 def _error_response(self, response):
     if response.text == '' or response.status_code != 200:
         raise ConnectionError('Status code: {}'.format(response.status_code))
     if str_to_error(response.text) is not None:
         raise ConnectionError(str_to_error(response.text))