Commit f11fca4f authored by adam's avatar adam

Working prototype

parent ab44e677
......@@ -7,5 +7,6 @@
"login":,
"password":,
},
"payload": {},
"expected_output": {}
}
......@@ -30,13 +30,36 @@ class Test:
else:
auth = None
req = requests.get(scenario["url"], auth=auth)
try:
res = requests.get(scenario["url"], auth=auth)
except Exception:
print "Test {0} failed!".format(scenario["name"])
return
if req.status_code == 200:
print "Test ", scenario["name"], "OK"
if res.status_code == 200:
if scenario.get("expected_output"):
if scenario.get("expected_output") == res.json():
print "Test {0} OK!".format(scenario["name"])
return
print "Test {0}, expected {1} but got {2}!".format(scenario["name"],
scenario["expected_output"], res.json())
def send_post_request(self, scenario):
pass
if scenario.get("user"):
auth = (scenario["user"]["login"], scenario["user"]["password"])
else:
auth = None
res = requests.path(scenario["url"], auth=auth, data=scenario.get("payload"))
if res.status_code == 200:
if scenario.get("expected_output"):
if scenario.get("expected_output") == res.json():
print "Test {0} OK!".format(scenario["name"])
return
print "Test {0}, expected {1} but got {2}!".format(scenario["name"],
scenario["expected_output"], res.json())
print "Test {0} failed!".format(scenario["name"])
test = Test()
......
......@@ -2,5 +2,5 @@
"name": "Login_page_up",
"description": "Checks if login page is up",
"method": "GET",
"url": "http://google.com"
"url": "http://localhost:8080/"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment