Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
    def test_unknown_fields(self, req, includes):
        """Unkown args should raise an error
        """
        req["fodokfowe"] = "Hello"

        with pytest.raises(exceptions.UnexpectedKeysError):
            TRequest(req, includes)
Beispiel #4
0
    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