diff --git a/tests/utils_pagination_test.py b/tests/utils_pagination_test.py index 027516c4..5b889203 100644 --- a/tests/utils_pagination_test.py +++ b/tests/utils_pagination_test.py @@ -121,9 +121,10 @@ def test_fetch_next_page_no_next_link(self): @patch("fhirclient._utils._execute_pagination_request") def test_iter_pages(self, mock_fetch_next_page): inst = self.instantiate_from("bundle-example.json") + inst_page2 = self.instantiate_from("bundle-example-page2.json") # Set up the mock to return a new bundle, then None to stop iteration - mock_fetch_next_page.side_effect = [inst, None] + mock_fetch_next_page.side_effect = [inst_page2, None] pages = list(iter_pages(inst)) # Check that two bundles were returned (the first bundle and the one from mock) @@ -131,9 +132,9 @@ def test_iter_pages(self, mock_fetch_next_page): self.assertIsInstance(pages[0], Bundle) self.assertIsInstance(pages[1], Bundle) - # Compare JSON representations instead of object instances + self.assertNotEqual(pages[0].as_json(), pages[1].as_json()) # Ensure the two pages are different self.assertEqual(pages[0].as_json(), inst.as_json()) - self.assertEqual(pages[1].as_json(), inst.as_json()) + self.assertEqual(pages[1].as_json(), inst_page2.as_json()) # Ensure the second page is correct # Ensure that _fetch_next_page was called twice self.assertEqual(mock_fetch_next_page.call_count, 2)