Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions hcloud/certificates/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ class ManagedCertificateStatus(BaseDomain):
If issuance or renewal reports failure, this property contains information about what happened
"""

__api_properties__ = (
"issuance",
"renewal",
"error",
)
__slots__ = __api_properties__

def __init__(
self,
issuance: str | None = None,
Expand All @@ -107,6 +114,12 @@ class ManagedCertificateError(BaseDomain):
Message detailing the error
"""

__api_properties__ = (
"code",
"message",
)
__slots__ = __api_properties__

def __init__(self, code: str | None = None, message: str | None = None):
self.code = code
self.message = message
Expand Down
53 changes: 53 additions & 0 deletions hcloud/load_balancers/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ class LoadBalancerServiceHttp(BaseDomain):
Use sticky sessions. Only available if protocol is "http" or "https".
"""

__api_properties__ = (
"cookie_name",
"cookie_lifetime",
"certificates",
"redirect_http",
"sticky_sessions",
)
__slots__ = __api_properties__

def __init__(
self,
cookie_name: str | None = None,
Expand Down Expand Up @@ -261,6 +270,16 @@ class LoadBalancerHealthCheck(BaseDomain):
HTTP Config
"""

__api_properties__ = (
"protocol",
"port",
"interval",
"timeout",
"retries",
"http",
)
__slots__ = __api_properties__

def __init__(
self,
protocol: str | None = None,
Expand Down Expand Up @@ -293,6 +312,15 @@ class LoadBalancerHealthCheckHttp(BaseDomain):
Type of health check
"""

__api_properties__ = (
"domain",
"path",
"response",
"status_codes",
"tls",
)
__slots__ = __api_properties__

def __init__(
self,
domain: str | None = None,
Expand Down Expand Up @@ -350,6 +378,16 @@ class LoadBalancerTarget(BaseDomain):
List of health statuses of the services on this target. Only present for target types "server" and "ip".
"""

__api_properties__ = (
"type",
"server",
"label_selector",
"ip",
"use_private_ip",
"health_status",
)
__slots__ = __api_properties__

def __init__(
self,
type: str | None = None,
Expand Down Expand Up @@ -401,6 +439,12 @@ class LoadBalancerTargetHealthStatus(BaseDomain):
:param status: Load Balancer Target status. Choices: healthy, unhealthy, unknown
"""

__api_properties__ = (
"listen_port",
"status",
)
__slots__ = __api_properties__

def __init__(
self,
listen_port: int | None = None,
Expand All @@ -416,6 +460,9 @@ class LoadBalancerTargetLabelSelector(BaseDomain):
:param selector: str Target label selector
"""

__api_properties__ = ("selector",)
__slots__ = __api_properties__

def __init__(self, selector: str | None = None):
self.selector = selector

Expand All @@ -426,6 +473,9 @@ class LoadBalancerTargetIP(BaseDomain):
:param ip: str Target IP
"""

__api_properties__ = ("ip",)
__slots__ = __api_properties__

def __init__(self, ip: str | None = None):
self.ip = ip

Expand All @@ -437,6 +487,9 @@ class LoadBalancerAlgorithm(BaseDomain):
Algorithm of the Load Balancer. Choices: round_robin, least_connections
"""

__api_properties__ = ("type",)
__slots__ = __api_properties__

def __init__(self, type: str | None = None):
self.type = type

Expand Down
10 changes: 10 additions & 0 deletions tests/unit/actions/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
)


@pytest.mark.parametrize(
"value",
[
(Action(id=1),),
],
)
def test_eq(value):
assert value == value


class TestAction:
def test_started_finished_is_datetime(self):
action = Action(
Expand Down
20 changes: 19 additions & 1 deletion tests/unit/certificates/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,25 @@
import datetime
from datetime import timezone

from hcloud.certificates import Certificate
import pytest

from hcloud.certificates import (
Certificate,
ManagedCertificateError,
ManagedCertificateStatus,
)


@pytest.mark.parametrize(
"value",
[
(Certificate(id=1),),
(ManagedCertificateError()),
(ManagedCertificateStatus()),
],
)
def test_eq(value):
assert value == value


class TestCertificate:
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/datacenters/test_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from __future__ import annotations

import pytest

from hcloud.datacenters import Datacenter, DatacenterServerTypes


@pytest.mark.parametrize(
"value",
[
(Datacenter(id=1),),
(DatacenterServerTypes(available=[], available_for_migration=[], supported=[])),
],
)
def test_eq(value):
assert value == value
Empty file.
15 changes: 15 additions & 0 deletions tests/unit/deprecation/test_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations

import pytest

from hcloud.deprecation import DeprecationInfo


@pytest.mark.parametrize(
"value",
[
(DeprecationInfo(),),
],
)
def test_eq(value):
assert value == value
24 changes: 23 additions & 1 deletion tests/unit/firewalls/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,29 @@
import datetime
from datetime import timezone

from hcloud.firewalls import Firewall
import pytest

from hcloud.firewalls import (
Firewall,
FirewallResource,
FirewallResourceAppliedToResources,
FirewallResourceLabelSelector,
FirewallRule,
)


@pytest.mark.parametrize(
"value",
[
(Firewall(id=1),),
(FirewallRule(direction="in", protocol="icmp", source_ips=[]),),
(FirewallResource(type="server"),),
(FirewallResourceAppliedToResources(type="server"),),
(FirewallResourceLabelSelector(),),
],
)
def test_eq(value):
assert value == value


class TestFirewall:
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/floating_ips/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
import datetime
from datetime import timezone

import pytest

from hcloud.floating_ips import FloatingIP


@pytest.mark.parametrize(
"value",
[
(FloatingIP(id=1),),
],
)
def test_eq(value):
assert value == value


class TestFloatingIP:
def test_created_is_datetime(self):
floatingIP = FloatingIP(id=1, created="2016-01-30T23:50+00:00")
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/images/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
import datetime
from datetime import timezone

import pytest

from hcloud.images import Image


@pytest.mark.parametrize(
"value",
[
(Image(id=1),),
],
)
def test_eq(value):
assert value == value


class TestImage:
def test_created_is_datetime(self):
image = Image(id=1, created="2016-01-30T23:50+00:00")
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/isos/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
from hcloud.isos import Iso


@pytest.mark.parametrize(
"value",
[
(Iso(id=1),),
],
)
def test_eq(value):
assert value == value


class TestIso:
@pytest.fixture()
def deprecated_iso(self):
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/load_balancer_types/test_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations

import pytest

from hcloud.load_balancer_types import LoadBalancerType


@pytest.mark.parametrize(
"value",
[
(LoadBalancerType(id=1),),
],
)
def test_eq(value):
assert value == value
48 changes: 47 additions & 1 deletion tests/unit/load_balancers/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,53 @@
import datetime
from datetime import timezone

from hcloud.load_balancers import LoadBalancer
import pytest

from hcloud.load_balancers import (
IPv4Address,
IPv6Network,
LoadBalancer,
LoadBalancerAlgorithm,
LoadBalancerHealthCheck,
LoadBalancerHealthCheckHttp,
LoadBalancerService,
LoadBalancerServiceHttp,
LoadBalancerTarget,
LoadBalancerTargetHealthStatus,
LoadBalancerTargetIP,
LoadBalancerTargetLabelSelector,
PrivateNet,
PublicNetwork,
)


@pytest.mark.parametrize(
"value",
[
(LoadBalancer(id=1),),
(LoadBalancerService,),
(LoadBalancerServiceHttp(),),
(LoadBalancerHealthCheck(),),
(LoadBalancerHealthCheckHttp(),),
(LoadBalancerTarget(),),
(LoadBalancerTargetHealthStatus(),),
(LoadBalancerTargetLabelSelector(),),
(LoadBalancerTargetIP(),),
(LoadBalancerAlgorithm(),),
(
PublicNetwork(
ipv4=IPv4Address(ip="127.0.0.1", dns_ptr="example.com"),
ipv6=IPv6Network("2001:0db8::0/64", dns_ptr="example.com"),
enabled=True,
),
),
(IPv4Address(ip="127.0.0.1", dns_ptr="example.com"),),
(IPv6Network("2001:0db8::0/64", dns_ptr="example.com"),),
(PrivateNet(network=object(), ip="127.0.0.1"),),
],
)
def test_eq(value):
assert value == value


class TestLoadBalancers:
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/locations/test_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations

import pytest

from hcloud.locations import Location


@pytest.mark.parametrize(
"value",
[
(Location(id=1),),
],
)
def test_eq(value):
assert value == value
Loading