Beispiel #1
0
    def __init__(self,
                 method,
                 url,
                 data=None,
                 headers=None,
                 priority=Priority.NORMAL,
                 timeout=None,
                 group=None,
                 retries=1,
                 ignore_ssl_cert_errors=False,
                 auth=None):
        """Creates an HttpValidation object that will make an HTTP request to
        the provided URL passing the provided headers.

        """
        Validation.__init__(self,
                            "{0} {1}".format(method, url),
                            priority=priority,
                            timeout=timeout,
                            group=group)

        self._url = url
        self._data = data
        self._method = method
        self._headers = copy.copy(headers) or {}
        self._response_code_expectation = _ExpectedStatusCodes(set([200]))
        self._expectations = []
        self._retries = retries
        self._ignore_ssl_cert_errors = ignore_ssl_cert_errors
        self._auth = auth or ()
        self._elapsed_time = -1
Beispiel #2
0
    def expect_status_codes(self, status_codes):
        """Add an expectation that the HTTP response will have one of the
        specified status_codes.

        """
        self._response_code_expectation = _ExpectedStatusCodes(status_codes)
        return self
Beispiel #3
0
    def expect_status_codes(self, status_codes):
        """Add an expectation that the HTTP response will have one of the
        specified status_codes.

        """
        self._response_code_expectation = _ExpectedStatusCodes(status_codes)
        return self
Beispiel #4
0
    def __init__(self, method, url, data=None, headers=None,
                 priority=Priority.NORMAL, timeout=None,
                 group=None, retries=1, ignore_ssl_cert_errors=False,
                 auth=None):
        """Creates an HttpValidation object that will make an HTTP request to
        the provided URL passing the provided headers.

        """
        super(HttpValidation, self).__init__("{0} {1}".format(method, url),
                                             priority=priority,
                                             timeout=timeout,
                                             group=group)

        self._url = url
        self._data = data
        self._method = method
        self._headers = copy.copy(headers) or {}
        self._response_code_expectation = _ExpectedStatusCodes(set([200]))
        self._expectations = []
        self._retries = retries
        self._ignore_ssl_cert_errors = ignore_ssl_cert_errors
        self._auth = auth or ()
        self._elapsed_time = -1