Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server_type): add field for included traffic #185

Merged
merged 1 commit into from
May 11, 2023
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
7 changes: 6 additions & 1 deletion hcloud/server_types/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class ServerType(BaseDomain, DomainIdentityMixin):
:param cpu_type: string
Type of cpu. Choices: `shared`, `dedicated`
:param architecture: string
Architecture of cpu. Choices: `x86`, `arm`
Architecture of cpu. Choices: `x86`, `arm`
:param deprecated: bool
True if server type is deprecated
:param included_traffic: int
Free traffic per month in bytes
"""

__slots__ = (
Expand All @@ -40,6 +42,7 @@ class ServerType(BaseDomain, DomainIdentityMixin):
"cpu_type",
"architecture",
"deprecated",
"included_traffic",
)

def __init__(
Expand All @@ -55,6 +58,7 @@ def __init__(
cpu_type=None,
architecture=None,
deprecated=None,
included_traffic=None,
):
self.id = id
self.name = name
Expand All @@ -67,3 +71,4 @@ def __init__(
self.cpu_type = cpu_type
self.architecture = architecture
self.deprecated = deprecated
self.included_traffic = included_traffic
4 changes: 4 additions & 0 deletions tests/unit/server_types/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def server_type_response():
"storage_type": "local",
"cpu_type": "shared",
"architecture": "x86",
"included_traffic": 21990232555520,
}
}

Expand Down Expand Up @@ -58,6 +59,7 @@ def two_server_types_response():
"storage_type": "local",
"cpu_type": "shared",
"architecture": "x86",
"included_traffic": 21990232555520,
},
{
"id": 2,
Expand Down Expand Up @@ -93,6 +95,7 @@ def two_server_types_response():
"storage_type": "local",
"cpu_type": "shared",
"architecture": "x86",
"included_traffic": 21990232555520,
},
]
}
Expand Down Expand Up @@ -125,6 +128,7 @@ def one_server_types_response():
"storage_type": "local",
"cpu_type": "shared",
"architecture": "x86",
"included_traffic": 21990232555520,
}
]
}
1 change: 1 addition & 0 deletions tests/unit/server_types/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_bound_server_type_init(self, server_type_response):
assert bound_server_type.storage_type == "local"
assert bound_server_type.cpu_type == "shared"
assert bound_server_type.architecture == "x86"
assert bound_server_type.included_traffic == 21990232555520


class TestServerTypesClient(object):
Expand Down