Skip to content

Commit 5db5ffd

Browse files
authored
Merge pull request #230 from jajreidy/fix-fake-match-all
Fixes matching to all when searching content in the fake client
2 parents 90e730e + 7db4caa commit 5db5ffd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

+2
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

+9
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)