Fix cookie tests and pep8

The cookie tests needed to confirm that there would be a failure
if cookies were expected but there was no set-cookie in the prior
response.
This commit is contained in:
Chris Dent 2016-05-31 18:14:33 +01:00
parent 1947ce952a
commit 4c3cc61ee9
3 changed files with 13 additions and 6 deletions

View File

@ -29,8 +29,8 @@ import unittest
from unittest import case
import six
from six.moves.urllib import parse as urlparse
from six.moves import http_cookies
from six.moves.urllib import parse as urlparse
import wsgi_intercept
from gabbi import __version__

View File

@ -6,7 +6,14 @@ tests:
set-cookie: session=1234; domain=.example.com
- name: use that cookie in a URL
desc: just to get it somewhere we can test it and confirm domain is dropped
GET: /cookie?$COOKIE
desc: to get it somewhere we can test it and confirm domain is dropped
GET: /foobar?$COOKIE
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/cookie?session=1234
x-gabbi-url: $SCHEME://$NETLOC/foobar?session=1234
- name: confirm no cookies causes error
desc: "this will cause data unavailable: set-cookie"
xfail: true
GET: /foobar?$COOKIE
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/foobar

View File

@ -7,12 +7,12 @@ shopt -s nocasematch
[[ "${GABBI_SKIP_NETWORK:-false}" == "true" ]] && SKIP=7 || SKIP=2
shopt -u nocasematch
GREP_FAIL_MATCH='expected failures=11,'
GREP_FAIL_MATCH='expected failures=12,'
GREP_SKIP_MATCH="skipped=$SKIP,"
GREP_UXSUC_MATCH='unexpected successes=1'
# This skip is always 2 because the pytest tests don't
# run the live tests.
PYTEST_MATCH='2 skipped, 11 xfailed'
PYTEST_MATCH='2 skipped, 12 xfailed'
python setup.py testr && \
for match in "${GREP_FAIL_MATCH}" "${GREP_UXSUC_MATCH}" "${GREP_SKIP_MATCH}"; do