forked from OpenCTI-Platform/client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_constants.py
31 lines (24 loc) · 1008 Bytes
/
test_constants.py
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
from pycti.utils.constants import (
ContainerTypes,
IdentityTypes,
LocationTypes,
StixCyberObservableTypes,
)
def test_for_enum_typos():
# Test check for typos between enum names and values
enums = [StixCyberObservableTypes, LocationTypes, IdentityTypes, ContainerTypes]
for enum in enums:
for data in enum:
name = data.name.replace("_", "-")
value = data.value.upper()
assert name == value
def test_for_enum_has_value_functionality():
# Test if the has_value function works as intended
assert StixCyberObservableTypes.has_value("url") is True
assert StixCyberObservableTypes.has_value("LRU") is False
assert LocationTypes.has_value("CITY") is True
assert LocationTypes.has_value("YTIC") is False
assert IdentityTypes.has_value("SECTOR") is True
assert IdentityTypes.has_value("RECTOS") is False
assert ContainerTypes.has_value("Note") is True
assert ContainerTypes.has_value("ETON") is False