Return all things when using "*" query_string parameter (#4960)
This commit is contained in:
parent
4f92ee8a1c
commit
5e55daebb8
@ -45,6 +45,8 @@ class FakeThing(BaseModel):
|
|||||||
self.thing_shadow = None
|
self.thing_shadow = None
|
||||||
|
|
||||||
def matches(self, query_string):
|
def matches(self, query_string):
|
||||||
|
if query_string == "*":
|
||||||
|
return True
|
||||||
if query_string.startswith("thingName:"):
|
if query_string.startswith("thingName:"):
|
||||||
qs = query_string[10:].replace("*", ".*").replace("?", ".")
|
qs = query_string[10:].replace("*", ".*").replace("?", ".")
|
||||||
return re.search(f"^{qs}$", self.thing_name)
|
return re.search(f"^{qs}$", self.thing_name)
|
||||||
|
@ -12,6 +12,7 @@ from moto import mock_iot
|
|||||||
["thingName:abc", {"abc"}],
|
["thingName:abc", {"abc"}],
|
||||||
["thingName:ab*", {"abc", "abd", "abcefg"}],
|
["thingName:ab*", {"abc", "abd", "abcefg"}],
|
||||||
["thingName:ab?", {"abc", "abd"}],
|
["thingName:ab?", {"abc", "abd"}],
|
||||||
|
["*", {"abc", "abd", "bbe", "abcefg", "uuuabc", "bbefg"}],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_search_things(query_string, results):
|
def test_search_things(query_string, results):
|
||||||
|
Loading…
Reference in New Issue
Block a user