-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtest_models_pro_scripts.py
More file actions
58 lines (49 loc) · 1.75 KB
/
test_models_pro_scripts.py
File metadata and controls
58 lines (49 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import json
from deepdiff import DeepDiff
from src.jamf_pro_sdk.models.pro.scripts import Script
SCRIPT_JSON = {
"script": {
"id": 73,
"name": "1_Set_Organization_Priorities-1.0.2.sh",
"info": "Some information",
"notes": "v1.0.2 31/1/2019",
"priority": "AFTER",
"parameter4": "",
"parameter5": "",
"parameter6": "",
"parameter7": "",
"parameter8": "",
"parameter9": "",
"parameter10": "",
"parameter11": "",
"osRequirements": "",
"scriptContents": '#!/bin/bash\n\norganization="My Organization"',
"categoryId": 15,
"categoryName": "CIS",
}
}
def test_script_model_parsings():
"""Verify select attributes across the Script model."""
script = Script(**SCRIPT_JSON["script"])
assert script is not None # mypy
assert script.id == 73
assert script.name == "1_Set_Organization_Priorities-1.0.2.sh"
assert script.info == "Some information"
assert script.notes == "v1.0.2 31/1/2019"
assert script.priority == "AFTER"
assert script.parameter4 == ""
assert script.parameter5 == ""
assert script.parameter6 == ""
assert script.parameter7 == ""
assert script.parameter8 == ""
assert script.parameter9 == ""
assert script.parameter10 == ""
assert script.parameter11 == ""
assert script.scriptContents == '#!/bin/bash\n\norganization="My Organization"'
assert script.categoryId == 15
assert script.categoryName == "CIS"
def test_script_json_output_matches_input():
script = Script(**SCRIPT_JSON["script"])
serialized_output = json.loads(script.json(exclude_none=True))
diff = DeepDiff(SCRIPT_JSON["script"], serialized_output, ignore_order=True)
assert not diff