Skip to content

Commit

Permalink
pass query to check_list_success
Browse files Browse the repository at this point in the history
  • Loading branch information
asuresh-code committed Oct 29, 2024
1 parent 714585f commit 3d335df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/unit/repositories/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ def call_list(self, entity_id: Optional[str], primary: Optional[bool]) -> None:
session=self.mock_session, entity_id=entity_id, primary=primary
)

def check_list_success(self) -> None:
def check_list_success(self, query: Optional[dict] = None) -> None:
"""Checks that a prior call to `call_list` worked as expected."""
self.images_collection.find.assert_called_once_with(session=self.mock_session)
self.images_collection.find.assert_called_once_with(session=self.mock_session, query=query)
assert self._obtained_image_out == self._expected_image_out


Expand All @@ -142,18 +142,18 @@ def test_list(self):
query = {"entity_id": IMAGE_IN_DATA_ALL_VALUES["entity_id"]}
self.mock_list([IMAGE_IN_DATA_ALL_VALUES], query=query)
self.call_list(entity_id=query["entity_id"])
self.check_list_success()
self.check_list_success(query)

def test_list(self):
"""Test listing all images with a primary argument."""
query = {"primary": False}
self.mock_list([IMAGE_IN_DATA_ALL_VALUES], query=query)
self.call_list(primary=query["primary"])
self.check_list_success()
self.check_list_success(query)

def test_list(self):
"""Test listing all images with an entity_id and primary argument."""
query = {"entity_id": IMAGE_IN_DATA_ALL_VALUES["entity_id"], "primary": False}
self.mock_list([IMAGE_IN_DATA_ALL_VALUES], query=query)
self.call_list(primary=query["primary"], entity_id=query["entity_id"])
self.check_list_success()
self.check_list_success(query)

0 comments on commit 3d335df

Please sign in to comment.