def test_httpretty_allows_to_chose_if_querystring_should_be_matched():
"HTTPretty should provide a way to not match regexes that have a different querystring"
HTTPretty.register_uri(
HTTPretty.GET,
re.compile("https://example.org/(?P<endpoint>\w+)/$"),
body="Nudge, nudge, wink, wink. Know what I mean?",
match_querystring=True
)
response = requests.get('https://example.org/what/')
expect(response.text).to.equal('Nudge, nudge, wink, wink. Know what I mean?')
try:
requests.get('https://example.org/what/?flying=coconuts')
raised = False
except requests.ConnectionError:
raised = True
assert raised is True
评论列表
文章目录