bdd: Compare unordered req's for :reload --force.
This commit is contained in:
parent
79680f505e
commit
d4c24c935c
@ -23,6 +23,7 @@ import re
|
|||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import collections
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import pytest_bdd as bdd
|
import pytest_bdd as bdd
|
||||||
@ -118,6 +119,18 @@ def list_of_loaded_pages(httpbin, pages):
|
|||||||
assert actual_requests == expected_requests
|
assert actual_requests == expected_requests
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.then(bdd.parsers.parse("The unordered requests should be:\n{pages}"))
|
||||||
|
def list_of_loaded_pages_unordered(httpbin, pages):
|
||||||
|
expected_requests = [httpbin.ExpectedRequest('GET', '/' + path.strip())
|
||||||
|
for path in pages.split('\n')]
|
||||||
|
actual_requests = httpbin.get_requests()
|
||||||
|
# Requests are not hashable, we need to convert to ExpectedRequests
|
||||||
|
actual_requests = map(httpbin.ExpectedRequest.from_request,
|
||||||
|
actual_requests)
|
||||||
|
assert (collections.Counter(actual_requests) ==
|
||||||
|
collections.Counter(expected_requests))
|
||||||
|
|
||||||
|
|
||||||
@bdd.then(bdd.parsers.re(r'the (?P<category>error|message|warning) '
|
@bdd.then(bdd.parsers.re(r'the (?P<category>error|message|warning) '
|
||||||
r'"(?P<message>.*)" should be shown.'))
|
r'"(?P<message>.*)" should be shown.'))
|
||||||
def expect_error(quteproc, httpbin, category, message):
|
def expect_error(quteproc, httpbin, category, message):
|
||||||
|
@ -160,7 +160,7 @@ Feature: Various utility commands.
|
|||||||
And I run :stop
|
And I run :stop
|
||||||
And I open custom/redirect-later-continue in a new tab
|
And I open custom/redirect-later-continue in a new tab
|
||||||
And I wait 1s
|
And I wait 1s
|
||||||
Then the requests should be:
|
Then the unordered requests should be:
|
||||||
custom/redirect-later-continue
|
custom/redirect-later-continue
|
||||||
custom/redirect-later?delay=-1
|
custom/redirect-later?delay=-1
|
||||||
# no request on / because we stopped the redirect
|
# no request on / because we stopped the redirect
|
||||||
|
Loading…
Reference in New Issue
Block a user