diff --git a/moto/iot/models.py b/moto/iot/models.py index 16792f5d4..b1ee30af7 100644 --- a/moto/iot/models.py +++ b/moto/iot/models.py @@ -45,6 +45,8 @@ class FakeThing(BaseModel): self.thing_shadow = None def matches(self, query_string): + if query_string == "*": + return True if query_string.startswith("thingName:"): qs = query_string[10:].replace("*", ".*").replace("?", ".") return re.search(f"^{qs}$", self.thing_name) diff --git a/tests/test_iot/test_iot_search.py b/tests/test_iot/test_iot_search.py index 41735fb10..72d596476 100644 --- a/tests/test_iot/test_iot_search.py +++ b/tests/test_iot/test_iot_search.py @@ -12,6 +12,7 @@ from moto import mock_iot ["thingName:abc", {"abc"}], ["thingName:ab*", {"abc", "abd", "abcefg"}], ["thingName:ab?", {"abc", "abd"}], + ["*", {"abc", "abd", "bbe", "abcefg", "uuuabc", "bbefg"}], ], ) def test_search_things(query_string, results):