Skip to content

Commit 7db4caa

Browse files
committed
Fixes matching to all when searching content in the fake client
1 parent 2c7ce6f commit 7db4caa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/pubtools/pulplib/_impl/fake/match.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def match_field_exists(_matcher, field, obj):
123123
@visit(InMatcher)
124124
def match_in(matcher, field, obj):
125125
value = get_field(field, obj)
126+
if field == "content_type_id" and not matcher._values:
127+
return True
126128
for elem in matcher._values:
127129
if elem == value:
128130
return True

tests/fake/test_fake_search_content.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,12 @@ def test_search_content_files(populated_repo):
327327
files=["/some/file", "/another/file", "/yet/another/file", "/script"],
328328
)
329329
]
330+
331+
332+
def test_search_content_all_type_ids(populated_repo):
333+
"""search_content with field content_type_ids and []"""
334+
335+
crit = Criteria.with_field_in("content_type_id", [])
336+
units = list(populated_repo.search_content(crit))
337+
338+
assert len(units) == 7

0 commit comments

Comments
 (0)