Skip to content

Commit 57038a7

Browse files
committed
chore: use kwargs in CheckStatus in tests
1 parent 3c1ebe1 commit 57038a7

2 files changed

Lines changed: 11 additions & 25 deletions

File tree

tests/unit/test_idle_check_subordinate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
import pytest
99

10-
from juju.client._definitions import (
11-
FullStatus,
12-
)
10+
from juju.client._definitions import FullStatus
1311
from juju.client.facade import _convert_response
1412
from juju.model._idle import CheckStatus, check
1513

tests/unit/test_idle_loop.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ def checks():
4141

4242
def test_at_least_units():
4343
def checks():
44-
yield CheckStatus({"u/0", "u/1", "u/2"}, {"u/0"}, {"u/0", "u/1", "u/2"})
45-
yield CheckStatus({"u/0", "u/1", "u/2"}, {"u/0", "u/1"}, {"u/0", "u/1", "u/2"})
46-
yield CheckStatus(
47-
{"u/0", "u/1", "u/2"}, {"u/0", "u/1", "u/2"}, {"u/0", "u/1", "u/2"}
48-
)
44+
units = {"u/0", "u/1", "u/2"}
45+
yield CheckStatus(units, ready_units={"u/0"}, idle_units=units)
46+
yield CheckStatus(units, ready_units={"u/0", "u/1"}, idle_units=units)
47+
yield CheckStatus(units, ready_units={"u/0", "u/1", "u/2"}, idle_units=units)
4948

5049
with freeze_time():
5150
assert unroll(
@@ -57,21 +56,10 @@ def checks():
5756

5857

5958
def test_for_exact_units():
60-
good = CheckStatus(
61-
{"u/0", "u/1", "u/2"},
62-
{"u/1", "u/2"},
63-
{"u/0", "u/1", "u/2"},
64-
)
65-
too_few = CheckStatus(
66-
{"u/0", "u/1", "u/2"},
67-
{"u/2"},
68-
{"u/0", "u/1", "u/2"},
69-
)
70-
too_many = CheckStatus(
71-
{"u/0", "u/1", "u/2"},
72-
{"u/1", "u/2", "u/0"},
73-
{"u/0", "u/1", "u/2"},
74-
)
59+
units = {"u/0", "u/1", "u/2"}
60+
good = CheckStatus(units, ready_units={"u/1", "u/2"}, idle_units=units)
61+
too_few = CheckStatus(units, ready_units={"u/2"}, idle_units=units)
62+
too_many = CheckStatus(units, ready_units={"u/1", "u/2", "u/0"}, idle_units=units)
7563

7664
def checks():
7765
yield too_few
@@ -89,8 +77,8 @@ def checks():
8977

9078

9179
def test_idle_ping_pong():
92-
good = CheckStatus({"hexanator/0"}, {"hexanator/0"}, {"hexanator/0"})
93-
bad = CheckStatus({"hexanator/0"}, {"hexanator/0"}, set())
80+
good = CheckStatus({"hexanator/0"}, {"hexanator/0"}, idle_units={"hexanator/0"})
81+
bad = CheckStatus({"hexanator/0"}, {"hexanator/0"}, idle_units=set())
9482

9583
def checks():
9684
with freeze_time() as clock:

0 commit comments

Comments
 (0)