Skip to content

Commit 51e951e

Browse files
committed
test: Decode force_set items so async store reads return model objects
The _get_store_item shim used to decode raw dicts on read. With it gone, MockAsyncFeatureStore.force_set must decode on write, as the real store does on init/upsert, so variation tests get model objects.
1 parent 4de4462 commit 51e951e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ldclient/testing/mock_async_components.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ async def init(self, all_data):
4444
async def force_set(self, kind, item):
4545
"""Directly insert an item into the store, bypassing version checks.
4646
47-
Useful for setting up test state without going through normal upsert semantics.
47+
Decodes the item into a model object, as the real store does on init/upsert,
48+
so reads return decoded objects. Useful for setting up test state without
49+
going through normal upsert semantics.
4850
"""
49-
self._items[kind][item['key']] = item
51+
self._items[kind][item['key']] = kind.decode(item)
5052

5153
async def force_delete(self, kind, key):
5254
"""Directly remove an item from the store.

0 commit comments

Comments
 (0)