Skip to content

Commit 27275d9

Browse files
committed
test: remove duplicate actions tests
1 parent fb8bed4 commit 27275d9

File tree

9 files changed

+0
-1134
lines changed

9 files changed

+0
-1134
lines changed

tests/unit/certificates/test_client.py

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import pytest
66

77
from hcloud import Client
8-
from hcloud.actions import BoundAction
98
from hcloud.certificates import (
109
BoundCertificate,
1110
Certificate,
@@ -19,59 +18,6 @@ class TestBoundCertificate:
1918
def bound_certificate(self, client: Client):
2019
return BoundCertificate(client.certificates, data=dict(id=14))
2120

22-
@pytest.mark.parametrize("params", [{"page": 1, "per_page": 10}, {}])
23-
def test_get_actions_list(
24-
self,
25-
request_mock: mock.MagicMock,
26-
client: Client,
27-
bound_certificate,
28-
response_get_actions,
29-
params,
30-
):
31-
request_mock.return_value = response_get_actions
32-
33-
result = bound_certificate.get_actions_list(**params)
34-
35-
request_mock.assert_called_with(
36-
method="GET",
37-
url="/certificates/14/actions",
38-
params=params,
39-
)
40-
41-
actions = result.actions
42-
assert result.meta is not None
43-
44-
assert len(actions) == 1
45-
assert isinstance(actions[0], BoundAction)
46-
assert actions[0]._client == client.actions
47-
assert actions[0].id == 13
48-
assert actions[0].command == "change_protection"
49-
50-
def test_get_actions(
51-
self,
52-
request_mock: mock.MagicMock,
53-
client: Client,
54-
bound_certificate,
55-
response_get_actions,
56-
):
57-
request_mock.return_value = response_get_actions
58-
59-
actions = bound_certificate.get_actions()
60-
61-
params = {"page": 1, "per_page": 50}
62-
63-
request_mock.assert_called_with(
64-
method="GET",
65-
url="/certificates/14/actions",
66-
params=params,
67-
)
68-
69-
assert len(actions) == 1
70-
assert isinstance(actions[0], BoundAction)
71-
assert actions[0]._client == client.actions
72-
assert actions[0].id == 13
73-
assert actions[0].command == "change_protection"
74-
7521
def test_bound_certificate_init(self, certificate_response):
7622
bound_certificate = BoundCertificate(
7723
client=mock.MagicMock(), data=certificate_response["certificate"]
@@ -397,69 +343,3 @@ def test_retry_issuance(
397343

398344
assert action.id == 14
399345
assert action.command == "issue_certificate"
400-
401-
def test_actions_get_by_id(
402-
self,
403-
request_mock: mock.MagicMock,
404-
certificates_client: CertificatesClient,
405-
response_get_actions,
406-
):
407-
request_mock.return_value = {"action": response_get_actions["actions"][0]}
408-
action = certificates_client.actions.get_by_id(13)
409-
410-
request_mock.assert_called_with(
411-
method="GET",
412-
url="/certificates/actions/13",
413-
)
414-
415-
assert isinstance(action, BoundAction)
416-
assert action._client == certificates_client._parent.actions
417-
assert action.id == 13
418-
assert action.command == "change_protection"
419-
420-
def test_actions_get_list(
421-
self,
422-
request_mock: mock.MagicMock,
423-
certificates_client: CertificatesClient,
424-
response_get_actions,
425-
):
426-
request_mock.return_value = response_get_actions
427-
428-
result = certificates_client.actions.get_list()
429-
430-
request_mock.assert_called_with(
431-
method="GET",
432-
url="/certificates/actions",
433-
params={},
434-
)
435-
436-
actions = result.actions
437-
assert result.meta is not None
438-
439-
assert len(actions) == 1
440-
assert isinstance(actions[0], BoundAction)
441-
assert actions[0]._client == certificates_client._parent.actions
442-
assert actions[0].id == 13
443-
assert actions[0].command == "change_protection"
444-
445-
def test_actions_get_all(
446-
self,
447-
request_mock: mock.MagicMock,
448-
certificates_client: CertificatesClient,
449-
response_get_actions,
450-
):
451-
request_mock.return_value = response_get_actions
452-
453-
actions = certificates_client.actions.get_all()
454-
455-
request_mock.assert_called_with(
456-
method="GET",
457-
url="/certificates/actions",
458-
params={"page": 1, "per_page": 50},
459-
)
460-
461-
assert len(actions) == 1
462-
assert isinstance(actions[0], BoundAction)
463-
assert actions[0]._client == certificates_client._parent.actions
464-
assert actions[0].id == 13
465-
assert actions[0].command == "change_protection"

tests/unit/firewalls/test_client.py

Lines changed: 0 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import pytest
66

77
from hcloud import Client
8-
from hcloud.actions import BoundAction
98
from hcloud.firewalls import (
109
BoundFirewall,
1110
Firewall,
@@ -72,63 +71,6 @@ def test_bound_firewall_init(self, firewall_response):
7271
]
7372
assert firewall_out_rule.description == "allow http out"
7473

75-
@pytest.mark.parametrize(
76-
"params", [{}, {"sort": ["created"], "page": 1, "per_page": 2}]
77-
)
78-
def test_get_actions_list(
79-
self,
80-
request_mock: mock.MagicMock,
81-
client: Client,
82-
bound_firewall,
83-
response_get_actions,
84-
params,
85-
):
86-
request_mock.return_value = response_get_actions
87-
88-
result = bound_firewall.get_actions_list(**params)
89-
90-
request_mock.assert_called_with(
91-
method="GET",
92-
url="/firewalls/1/actions",
93-
params=params,
94-
)
95-
96-
actions = result.actions
97-
assert result.meta is not None
98-
99-
assert len(actions) == 1
100-
assert isinstance(actions[0], BoundAction)
101-
assert actions[0]._client == client.actions
102-
assert actions[0].id == 13
103-
assert actions[0].command == "set_firewall_rules"
104-
105-
@pytest.mark.parametrize("params", [{}, {"sort": ["created"]}])
106-
def test_get_actions(
107-
self,
108-
request_mock: mock.MagicMock,
109-
client: Client,
110-
bound_firewall,
111-
response_get_actions,
112-
params,
113-
):
114-
request_mock.return_value = response_get_actions
115-
116-
actions = bound_firewall.get_actions(**params)
117-
118-
params.update({"page": 1, "per_page": 50})
119-
120-
request_mock.assert_called_with(
121-
method="GET",
122-
url="/firewalls/1/actions",
123-
params=params,
124-
)
125-
126-
assert len(actions) == 1
127-
assert isinstance(actions[0], BoundAction)
128-
assert actions[0]._client == client.actions
129-
assert actions[0].id == 13
130-
assert actions[0].command == "set_firewall_rules"
131-
13274
def test_update(
13375
self,
13476
request_mock: mock.MagicMock,
@@ -379,36 +321,6 @@ def test_get_by_name(
379321
assert firewall.id == 38
380322
assert firewall.name == "Corporate Intranet Protection"
381323

382-
@pytest.mark.parametrize(
383-
"firewall", [Firewall(id=1), BoundFirewall(mock.MagicMock(), dict(id=1))]
384-
)
385-
def test_get_actions_list(
386-
self,
387-
request_mock: mock.MagicMock,
388-
firewalls_client: FirewallsClient,
389-
firewall,
390-
response_get_actions,
391-
):
392-
request_mock.return_value = response_get_actions
393-
394-
result = firewalls_client.get_actions_list(firewall)
395-
396-
request_mock.assert_called_with(
397-
method="GET",
398-
url="/firewalls/1/actions",
399-
params={},
400-
)
401-
402-
actions = result.actions
403-
assert result.meta is not None
404-
405-
assert len(actions) == 1
406-
assert isinstance(actions[0], BoundAction)
407-
408-
assert actions[0]._client == firewalls_client._parent.actions
409-
assert actions[0].id == 13
410-
assert actions[0].command == "set_firewall_rules"
411-
412324
def test_create(
413325
self,
414326
request_mock: mock.MagicMock,
@@ -599,69 +511,3 @@ def test_remove_from_resources(
599511

600512
assert actions[0].id == 13
601513
assert actions[0].progress == 100
602-
603-
def test_actions_get_by_id(
604-
self,
605-
request_mock: mock.MagicMock,
606-
firewalls_client: FirewallsClient,
607-
response_get_actions,
608-
):
609-
request_mock.return_value = {"action": response_get_actions["actions"][0]}
610-
action = firewalls_client.actions.get_by_id(13)
611-
612-
request_mock.assert_called_with(
613-
method="GET",
614-
url="/firewalls/actions/13",
615-
)
616-
617-
assert isinstance(action, BoundAction)
618-
assert action._client == firewalls_client._parent.actions
619-
assert action.id == 13
620-
assert action.command == "set_firewall_rules"
621-
622-
def test_actions_get_list(
623-
self,
624-
request_mock: mock.MagicMock,
625-
firewalls_client: FirewallsClient,
626-
response_get_actions,
627-
):
628-
request_mock.return_value = response_get_actions
629-
630-
result = firewalls_client.actions.get_list()
631-
632-
request_mock.assert_called_with(
633-
method="GET",
634-
url="/firewalls/actions",
635-
params={},
636-
)
637-
638-
actions = result.actions
639-
assert result.meta is not None
640-
641-
assert len(actions) == 1
642-
assert isinstance(actions[0], BoundAction)
643-
assert actions[0]._client == firewalls_client._parent.actions
644-
assert actions[0].id == 13
645-
assert actions[0].command == "set_firewall_rules"
646-
647-
def test_actions_get_all(
648-
self,
649-
request_mock: mock.MagicMock,
650-
firewalls_client: FirewallsClient,
651-
response_get_actions,
652-
):
653-
request_mock.return_value = response_get_actions
654-
655-
actions = firewalls_client.actions.get_all()
656-
657-
request_mock.assert_called_with(
658-
method="GET",
659-
url="/firewalls/actions",
660-
params={"page": 1, "per_page": 50},
661-
)
662-
663-
assert len(actions) == 1
664-
assert isinstance(actions[0], BoundAction)
665-
assert actions[0]._client == firewalls_client._parent.actions
666-
assert actions[0].id == 13
667-
assert actions[0].command == "set_firewall_rules"

0 commit comments

Comments
 (0)