Skip to content

Commit 9015558

Browse files
committed
test(redis): support hset mapping in redis session mocks
1 parent b774b2e commit 9015558

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/sessions/test_redis_session_service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ async def execute_command(self, session, command):
8383
return [k for k in self._store.keys() if k.startswith(prefix)]
8484
elif method == 'hset':
8585
key = args[0]
86-
pairs = args[1:]
8786
if key not in self._hash_store:
8887
self._hash_store[key] = {}
88+
mapping = getattr(command, "kwargs", {}).get("mapping", {})
89+
if mapping:
90+
self._hash_store[key].update(mapping)
91+
return True
92+
pairs = args[1:]
8993
for i in range(0, len(pairs), 2):
9094
self._hash_store[key][pairs[i]] = pairs[i + 1]
9195
return True

0 commit comments

Comments
 (0)