You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

49 lines
1.7 KiB

import requests
import json
from config import url_base
def test_case_basic():
case_id = "1f4g5"
body = {"SessionID": "a"}
response = requests.post(url_base() + "/api/Case/"+case_id, json=body)
data = json.loads(response.text)
print(data)
assert data["id"] == case_id
def test_case_unauthorized():
case_id = "1f4g5"
body = {"SessionID": "b"}
response = requests.post(url_base() + "/api/Case/"+case_id, json=body)
assert response.status_code == 401
def test_case_update():
case_id = "5f6h4"
body = {"CaseID": case_id, "UpdateMsg": "a", "SessionID": "a"}
response = requests.put(url_base() + "/api/Case/"+case_id+"/update", json=body)
assert response.status_code == 200
def test_case_update_unauthorized():
case_id = "5f6h4"
body = {"CaseID": case_id, "UpdateMsg": "a", "SessionID": "b"}
response = requests.put(url_base() + "/api/Case/"+case_id+"/update", json=body)
assert response.status_code == 401
def test_case_close():
case_id = "5f6h4"
body = {"CaseID": case_id, "UpdateMsg": "a", "SessionID": "a"}
response = requests.put(url_base() + "/api/Case/"+case_id+"/close", json=body)
assert response.status_code == 200
def test_case_close_unauthorized():
case_id = "5f6h4"
body = {"CaseID": case_id, "UpdateMsg": "a", "SessionID": "b"}
response = requests.put(url_base() + "/api/Case/"+case_id+"/close", json=body)
assert response.status_code == 401
def test_case_filter():
parent_id = "34g5g53"
body = {"SessionID": "a", "Filters": {"ParentID": parent_id}}
response = requests.post(url_base() + "/api/Case/filter", json=body)
data = json.loads(response.text)
for i in data["cases"]:
assert i["parentID"] == parent_id