Skip to content

Commit e76039c

Browse files
Add integration tests
1 parent 266d29d commit e76039c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from linode_api4 import FirewallTemplate, MappedObject
2+
3+
4+
def __assert_firewall_template_rules(rules: MappedObject):
5+
# We can't confidently say that these rules will not be changed
6+
# in the future, so we can just do basic assertions here.
7+
assert isinstance(rules.inbound_policy, str)
8+
assert len(rules.inbound_policy) > 0
9+
10+
assert isinstance(rules.outbound_policy, str)
11+
assert len(rules.outbound_policy) > 0
12+
13+
assert isinstance(rules.outbound, list)
14+
assert (rules.inbound, list)
15+
16+
17+
def test_list_firewall_templates(test_linode_client):
18+
templates = test_linode_client.networking.firewall_templates()
19+
assert len(templates) > 0
20+
21+
for template in templates:
22+
assert isinstance(template.slug, str)
23+
assert len(template.slug) > 0
24+
25+
__assert_firewall_template_rules(template.rules)
26+
27+
28+
def test_get_firewall_template(test_linode_client):
29+
template = test_linode_client.load(FirewallTemplate, "vpc")
30+
31+
assert template.slug == "vpc"
32+
33+
__assert_firewall_template_rules(template.rules)

0 commit comments

Comments
 (0)