Skip to content

Commit

Permalink
remove impl details from estore unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ritch committed Nov 12, 2024
1 parent dd3555d commit 99ab227
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions tests/unittests/execution_store_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,6 @@ def test_get(self):
value = self.store.get("widget_1")
assert value == {"name": "Widget One", "value": 100}
self.mock_collection.find_one.assert_called_once()
self.mock_collection.find_one.assert_called_with(
{
"store_name": "mock_store",
"key": "widget_1",
"dataset_id": None,
}
)

def test_list_keys(self):
self.mock_collection.find.return_value = [
Expand All @@ -240,50 +233,16 @@ def test_list_keys(self):
keys = self.store.list_keys()
assert keys == ["widget_1", "widget_2"]
self.mock_collection.find.assert_called_once()
self.mock_collection.find.assert_called_with(
{
"store_name": "mock_store",
"key": {"$ne": "__store__"},
"dataset_id": None,
},
{"key": 1},
)

def test_has_store(self):
self.mock_collection.find_one.return_value = {
"store_name": "mock_store",
"key": "__store__",
}
has_store = self.store_service.has_store("mock_store")
assert has_store
self.mock_collection.find_one.assert_called_once()
self.mock_collection.find_one.assert_called_with(
{
"store_name": "mock_store",
"key": "__store__",
"dataset_id": None,
}
)

def test_delete(self):
self.mock_collection.delete_one.return_value = Mock(deleted_count=1)
deleted = self.store.delete("widget_1")
assert deleted
self.mock_collection.delete_one.assert_called_once()
self.mock_collection.delete_one.assert_called_with(
{
"store_name": "mock_store",
"key": "widget_1",
"dataset_id": None,
}
)

def test_clear(self):
self.store.clear()
self.mock_collection.delete_many.assert_called_once()
self.mock_collection.delete_many.assert_called_with(
{"store_name": "mock_store", "dataset_id": None}
)


class ExecutionStoreServiceDatasetIdTests(unittest.TestCase):
Expand Down

0 comments on commit 99ab227

Please sign in to comment.