def test_saved_value_in_validate(self, nested_response, nested_schema, includes): r = RestResponse(Mock(), "Test 1", nested_schema, includes) class FakeResponse: headers = nested_response["headers"] content = "test".encode("utf8") def json(self): return nested_response["body"] status_code = nested_response["status_code"] r.verify(FakeResponse())
def test_incorrect_status_code(self, example_response, includes): """Test full verification + return saved values """ r = RestResponse(Mock(), "Test 1", example_response, includes) class FakeResponse: headers = example_response["headers"] content = "test".encode("utf8") def json(self): return example_response["body"] status_code = 400 with pytest.raises(exceptions.TestFailError): r.verify(FakeResponse()) assert r.errors
def test_validate_and_save(self, example_response, includes): """Test full verification + return saved values """ example_response["save"] = {"body": {"test_code": "code"}} r = RestResponse(Mock(), "Test 1", example_response, includes) class FakeResponse: headers = example_response["headers"] content = "test".encode("utf8") def json(self): return example_response["body"] status_code = example_response["status_code"] saved = r.verify(FakeResponse()) assert saved == {"test_code": example_response["body"]["code"]}