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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ venv:

lint: venv
venv/bin/pylint hcloud
venv/bin/pylint tests --disable=missing-function-docstring,use-dict-literal,protected-access,redefined-outer-name,unnecessary-dunder-call
venv/bin/mypy hcloud

test: venv
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/actions/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestAction:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/certificates/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestCertificate:
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/core/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_get_non_exists_model_attribute_complete_model(
client=client, data={"id": 1, "name": "name", "description": "description"}
)
with pytest.raises(AttributeError):
bound_model.content
_ = bound_model.content
client.get_by_id.assert_not_called()

def test_get_exists_model_attribute_incomplete_model(
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_get_non_exists_model_attribute_incomplete_model(
):
bound_model = bound_model_class(client=client, data={"id": 1}, complete=False)
with pytest.raises(AttributeError):
bound_model.content
_ = bound_model.content
client.get_by_id.assert_not_called()
assert bound_model.complete is False

Expand Down Expand Up @@ -137,7 +137,7 @@ def get_actions_list(self, status, page=None, per_page=None):
def test_iter_pages_no_meta(self, client_class_constructor):
json_content = {"candies": [1, 2]}

def json_content_function(p):
def json_content_function(_):
return json_content

candies_client = client_class_constructor(json_content_function)
Expand All @@ -152,7 +152,7 @@ def test_iter_pages_no_next_page(self, client_class_constructor):
"meta": {"pagination": {"page": 1, "per_page": 11, "next_page": None}},
}

def json_content_function(p):
def json_content_function(_):
return json_content

candies_client = client_class_constructor(json_content_function)
Expand Down Expand Up @@ -218,7 +218,7 @@ def json_content_function(p):
def test_get_first_by_result_exists(self, client_class_constructor):
json_content = {"candies": [1]}

def json_content_function(p):
def json_content_function(_):
return json_content

candies_client = client_class_constructor(json_content_function)
Expand All @@ -230,7 +230,7 @@ def json_content_function(p):
def test_get_first_by_result_does_not_exist(self, client_class_constructor):
json_content = {"candies": []}

def json_content_function(p):
def json_content_function(_):
return json_content

candies_client = client_class_constructor(json_content_function)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/datacenters/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)
2 changes: 1 addition & 1 deletion tests/unit/deprecation/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)
6 changes: 3 additions & 3 deletions tests/unit/exp/test_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def test_is_txt_record_quoted(value: str, expected: bool):
assert is_txt_record_quoted(value) == expected


manyA = "a" * 255
someB = "b" * 10
MANY_A = "a" * 255
SOME_B = "b" * 10


@pytest.mark.parametrize(
Expand All @@ -30,7 +30,7 @@ def test_is_txt_record_quoted(value: str, expected: bool):
("hello\nworld", '"hello\nworld"'),
('hello "world"', '"hello \\"world\\""'),
('hello "world', '"hello \\"world"'),
(manyA + someB, f'"{manyA}" "{someB}"'),
(MANY_A + SOME_B, f'"{MANY_A}" "{SOME_B}"'),
],
)
def test_format_txt_record(value: str, expected: str):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/firewalls/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestFirewall:
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/floating_ips/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,10 @@ def test_create_with_server(
assert bound_floating_ip.description == "Web Frontend"
assert action.id == 13

@pytest.mark.parametrize(
"server", [Server(id=1), BoundServer(mock.MagicMock(), dict(id=1))]
)
def test_create_with_name(
self,
request_mock: mock.MagicMock,
floating_ips_client: FloatingIPsClient,
server,
floating_ip_create_response,
):
request_mock.return_value = floating_ip_create_response
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/floating_ips/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestFloatingIP:
def test_created_is_datetime(self):
floatingIP = FloatingIP(id=1, created="2016-01-30T23:50+00:00")
assert floatingIP.created == datetime.datetime(
floating_ip = FloatingIP(id=1, created="2016-01-30T23:50+00:00")
assert floating_ip.created == datetime.datetime(
2016, 1, 30, 23, 50, tzinfo=timezone.utc
)
2 changes: 1 addition & 1 deletion tests/unit/images/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestImage:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/isos/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestIso:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/load_balancer_types/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)
2 changes: 1 addition & 1 deletion tests/unit/load_balancers/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestLoadBalancers:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/locations/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)
2 changes: 1 addition & 1 deletion tests/unit/networks/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestNetwork:
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/placement_groups/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def test_get_by_id(

request_mock.assert_called_with(
method="GET",
url="/placement_groups/{placement_group_id}".format(
placement_group_id=placement_group_response["placement_group"]["id"]
),
url="/placement_groups/897",
)

assert placement_group._client is resource_client
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/placement_groups/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestPlacementGroup:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/primary_ips/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestPrimaryIP:
def test_created_is_datetime(self):
primaryIP = PrimaryIP(id=1, created="2016-01-30T23:50+00:00")
assert primaryIP.created == datetime.datetime(
primary_ip = PrimaryIP(id=1, created="2016-01-30T23:50+00:00")
assert primary_ip.created == datetime.datetime(
2016, 1, 30, 23, 50, tzinfo=timezone.utc
)
2 changes: 1 addition & 1 deletion tests/unit/server_types/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)
1 change: 1 addition & 0 deletions tests/unit/servers/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def resource_client(self, client: Client):
def bound_model(self, resource_client: ServersClient):
return BoundServer(resource_client, data=dict(id=14))

# pylint: disable=too-many-statements
def test_init(self, response_full_server):
bound_server = BoundServer(
client=mock.MagicMock(), data=response_full_server["server"]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/servers/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestServer:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/ssh_keys/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestSSHKey:
def test_created_is_datetime(self):
sshKey = SSHKey(id=1, created="2016-01-30T23:50+00:00")
assert sshKey.created == datetime.datetime(
ssh_key = SSHKey(id=1, created="2016-01-30T23:50+00:00")
assert ssh_key.created == datetime.datetime(
2016, 1, 30, 23, 50, tzinfo=timezone.utc
)
2 changes: 1 addition & 1 deletion tests/unit/volumes/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
)
def test_eq(value):
assert value == value
assert value.__eq__(value)


class TestVolume:
Expand Down