Skip to content

Commit 740d169

Browse files
authored
fix: missing __api_properties__ on LoadBalancerService (#639)
Closes #638 Added a test to make sure all classes inheriting from BaseDomain implements the `__api_properties__` property.
1 parent 8458a52 commit 740d169

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

hcloud/load_balancers/domain.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ class LoadBalancerService(BaseDomain):
160160
Configuration for http/https protocols, required when protocol is http/https
161161
"""
162162

163+
__api_properties__ = (
164+
"protocol",
165+
"listen_port",
166+
"destination_port",
167+
"proxyprotocol",
168+
"health_check",
169+
"http",
170+
)
171+
__slots__ = __api_properties__
172+
163173
def __init__(
164174
self,
165175
protocol: str | None = None,

tests/unit/core/test_domain.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,9 @@ def test_nested_list__eq__(self):
191191
d2.child = [ActionDomain(id=2, name="child2")]
192192

193193
assert d1 != d2
194+
195+
196+
def test_base_domain_subclasses():
197+
for c in BaseDomain.__subclasses__():
198+
assert len(c.__api_properties__) > 0
199+
assert len(c.__slots__) > 0

0 commit comments

Comments
 (0)