def test_missing_format(self, req, includes): """All format variables should be present """ del includes["variables"]["code"] with pytest.raises(exceptions.MissingFormatError): TRequest(req, includes)
def test_bad_get_body(self, req, includes): """Can't add a body with a GET request """ req["method"] = "GET" with pytest.raises(exceptions.BadSchemaError): TRequest(req, includes)
def test_unknown_fields(self, req, includes): """Unkown args should raise an error """ req["fodokfowe"] = "Hello" with pytest.raises(exceptions.UnexpectedKeysError): TRequest(req, includes)
def test_session_called_no_redirects(self, req, includes): """Always disable redirects """ with patch("tavern.request.requests.Session.request") as rmock: TRequest(req, includes).run() assert rmock.called assert rmock.call_args[1]["allow_redirects"] == False