Use httpbin.Request namedtuple for comparisons.
This makes it easier to look at the pytest diff when things go wrong.
This commit is contained in:
parent
6e786ff9b7
commit
8664e45558
@ -45,10 +45,11 @@ def run_command(quteproc, command):
|
||||
@bdd.then(bdd.parsers.parse("{path} should be loaded"))
|
||||
def path_should_be_loaded(httpbin, path):
|
||||
requests = httpbin.get_requests()
|
||||
assert requests[-1] == ('GET', '/' + path)
|
||||
assert requests[-1] == httpbin.Request('GET', '/' + path)
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.parse("The requests should be:\n{pages}"))
|
||||
def lost_of_loaded_pages(httpbin, pages):
|
||||
requests = [('GET', '/' + path.strip()) for path in pages.split('\n')]
|
||||
requests = [httpbin.Request('GET', '/' + path.strip())
|
||||
for path in pages.split('\n')]
|
||||
assert httpbin.get_requests() == requests
|
||||
|
@ -46,5 +46,5 @@ def test_httpbin(httpbin, qtbot, path, content, expected):
|
||||
|
||||
data = response.read().decode('utf-8')
|
||||
|
||||
assert httpbin.get_requests() == [('GET', path)]
|
||||
assert httpbin.get_requests() == [httpbin.Request('GET', path)]
|
||||
assert (content in data) == expected
|
||||
|
@ -51,6 +51,7 @@ class HTTPBin(testprocess.Process):
|
||||
"""
|
||||
|
||||
new_request = pyqtSignal(Request)
|
||||
Request = Request # So it can be used from the fixture easily.
|
||||
|
||||
LOG_RE = re.compile(r"""
|
||||
(?P<host>[^ ]*)
|
||||
|
Loading…
Reference in New Issue
Block a user