def test_bad_coding_guess(self): bad_json = b'[\"cat\", \"dog\"][\"cat\", \"dog\"]' response = HttpResponse(status_code=http_client.OK, headers={}, content=bad_json) with pytest.raises(OsbsResponseException) as exc_info: response.json() assert 'HtttpResponse has corrupt json' in exc_info.value.message
def test_simple_response(self): content_json = b'"this is content"' content_str = "this is content" response = HttpResponse(status_code=http_client.OK, headers={}, content=content_json) assert content_str == response.json()