-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
enhancementNew feature or requestNew feature or requesttestRegression test relatedRegression test related
Milestone
Description
Alternative idea: add a plain function, curl(url)
, in test/infamy/util.py
that does the meat of Furl::check()
.
Then the examples above would be:
API = "http://example.com/api"
if "success" in curl(API):
print("API returned success")
# Multiple needle check (all must match)
response = curl(API)
if all([n in response for n in ("user: alice", "status: active", "role: admin")]):
print("All user details found")
# Check from network namespace
with IsolatedMacVlan("eth0") as ns:
if "expected content" in ns.call(lambda: curl(API)):
print("Content verified from namespace")
This is a bit more composable when the next type of HTTP check pops up. Also, having the logic of the check ("all must exist", in this case) in the test case makes it easier to see what is going on, at least to me.
Originally posted by @wkz in #1135 (comment)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesttestRegression test relatedRegression test related
Type
Projects
Status
No status