|
@@ 33-56 (lines=24) @@
|
| 30 |
|
assert "required" in message["error_validator"] |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
def test_additional_properties(): |
| 34 |
|
"""test should_fail_due_to_additional_properties_on_payload""" |
| 35 |
|
actual_dir = os.getcwd() |
| 36 |
|
evc_params = actual_dir + "/tests/oas/evc_params.json" |
| 37 |
|
with open(evc_params, encoding="utf8") as json_file: |
| 38 |
|
json_data = json.load(json_file) |
| 39 |
|
json_file.close() |
| 40 |
|
url = json_data["url"] |
| 41 |
|
headers = json_data["headers"] |
| 42 |
|
payload = { |
| 43 |
|
"name": "EVC_1", |
| 44 |
|
"enabled": True, |
| 45 |
|
"uni_a": json_data["uni_a"], |
| 46 |
|
"uni_z": json_data["uni_z"], |
| 47 |
|
"bandwidth": json_data["bandwidth"], |
| 48 |
|
"dynamic_backup_path": True, |
| 49 |
|
"active": True, |
| 50 |
|
} |
| 51 |
|
request_data = json.dumps(payload) |
| 52 |
|
response = requests.post(url=url, data=request_data, headers=headers) |
| 53 |
|
json_response = response.json() |
| 54 |
|
message = json.loads(json_response["description"]).get("message") |
| 55 |
|
assert response.status_code == 400 |
| 56 |
|
assert "additionalProperties" in message["error_validator"] |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
def test_pattern(): |
|
@@ 9-30 (lines=22) @@
|
| 6 |
|
import requests |
| 7 |
|
|
| 8 |
|
|
| 9 |
|
def test_required(): |
| 10 |
|
"""test should_fail_due_to_missing_name_attribute_on_payload""" |
| 11 |
|
actual_dir = os.getcwd() |
| 12 |
|
evc_params = actual_dir + "/tests/oas/evc_params.json" |
| 13 |
|
with open(evc_params, encoding="utf8") as json_file: |
| 14 |
|
json_data = json.load(json_file) |
| 15 |
|
json_file.close() |
| 16 |
|
url = json_data["url"] |
| 17 |
|
headers = json_data["headers"] |
| 18 |
|
payload = { |
| 19 |
|
"enabled": True, |
| 20 |
|
"uni_a": json_data["uni_a"], |
| 21 |
|
"uni_z": json_data["uni_z"], |
| 22 |
|
"bandwidth": json_data["bandwidth"], |
| 23 |
|
"dynamic_backup_path": True, |
| 24 |
|
} |
| 25 |
|
request_data = json.dumps(payload) |
| 26 |
|
response = requests.post(url=url, data=request_data, headers=headers) |
| 27 |
|
json_response = response.json() |
| 28 |
|
assert response.status_code == 400 |
| 29 |
|
message = json.loads(json_response["description"]).get("message") |
| 30 |
|
assert "required" in message["error_validator"] |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
def test_additional_properties(): |