forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_firewall_templates.py
More file actions
33 lines (21 loc) · 1.03 KB
/
test_firewall_templates.py
File metadata and controls
33 lines (21 loc) · 1.03 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
from linode_api4 import FirewallTemplate, MappedObject
def __assert_firewall_template_rules(rules: MappedObject):
# We can't confidently say that these rules will not be changed
# in the future, so we can just do basic assertions here.
assert isinstance(rules.inbound_policy, str)
assert len(rules.inbound_policy) > 0
assert isinstance(rules.outbound_policy, str)
assert len(rules.outbound_policy) > 0
assert isinstance(rules.outbound, list)
assert isinstance(rules.inbound, list)
def test_list_firewall_templates(test_linode_client):
templates = test_linode_client.networking.firewall_templates()
assert len(templates) > 0
for template in templates:
assert isinstance(template.slug, str)
assert len(template.slug) > 0
__assert_firewall_template_rules(template.rules)
def test_get_firewall_template(test_linode_client):
template = test_linode_client.load(FirewallTemplate, "vpc")
assert template.slug == "vpc"
__assert_firewall_template_rules(template.rules)