Skip to content

Commit 83a8613

Browse files
committed
testing listing with filter
1 parent c8bcfd8 commit 83a8613

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_db_repositories_comp_runs.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,24 @@ async def test_list(
107107
await CompRunsRepository(aiopg_engine).list(), key=lambda x: x.iteration
108108
) == sorted(created, key=lambda x: x.iteration)
109109

110+
# test with filter of state
111+
any_state_but_published = {
112+
s for s in RunningState if s is not RunningState.PUBLISHED
113+
}
114+
assert (
115+
await CompRunsRepository(aiopg_engine).list(
116+
filter_by_state=any_state_but_published
117+
)
118+
== []
119+
)
120+
121+
assert sorted(
122+
await CompRunsRepository(aiopg_engine).list(
123+
filter_by_state={RunningState.PUBLISHED}
124+
),
125+
key=lambda x: x.iteration,
126+
) == sorted(created, key=lambda x: x.iteration)
127+
110128

111129
async def test_create(
112130
aiopg_engine,

0 commit comments

Comments
 (0)