|
12 | 12 | import unittest
|
13 | 13 | from dataclasses import astuple, dataclass, field
|
14 | 14 | from typing import Iterable, List, Optional
|
15 |
| -from unittest.mock import call, patch |
16 | 15 |
|
17 | 16 | from tests import utils
|
18 | 17 | from tests.repository_simulator import RepositorySimulator
|
@@ -235,27 +234,24 @@ def test_graph_traversal(self, test_data: DelegationsTestCase) -> None:
|
235 | 234 |
|
236 | 235 | try:
|
237 | 236 | exp_files = [*TOP_LEVEL_ROLE_NAMES, *test_data.visited_order]
|
238 |
| - exp_calls = [call(role, 1) for role in test_data.visited_order] |
| 237 | + exp_calls = [(role, 1) for role in test_data.visited_order] |
239 | 238 |
|
240 | 239 | sim = self.setup_subtest(test_data.delegations)
|
241 | 240 | updater = self._init_updater(sim)
|
242 | 241 | # Call explicitly refresh to simplify the expected_calls list
|
243 | 242 | updater.refresh()
|
| 243 | + sim.fetch_tracker.metadata.clear() |
244 | 244 | # Check that metadata dir contains only top-level roles
|
245 | 245 | self._assert_files_exist(TOP_LEVEL_ROLE_NAMES)
|
246 | 246 |
|
247 |
| - with patch.object( |
248 |
| - sim, "fetch_metadata", wraps=sim.fetch_metadata |
249 |
| - ) as wrapped_fetch: |
250 |
| - # Looking for a non-existing targetpath forces updater |
251 |
| - # to visit all possible delegated roles |
252 |
| - targetfile = updater.get_targetinfo("missingpath") |
253 |
| - |
254 |
| - self.assertIsNone(targetfile) |
255 |
| - # Check that the delegated roles were visited in the expected |
256 |
| - # order and the corresponding metadata files were persisted |
257 |
| - self.assertListEqual(wrapped_fetch.call_args_list, exp_calls) |
258 |
| - self._assert_files_exist(exp_files) |
| 247 | + # Looking for a non-existing targetpath forces updater |
| 248 | + # to visit all possible delegated roles |
| 249 | + targetfile = updater.get_targetinfo("missingpath") |
| 250 | + self.assertIsNone(targetfile) |
| 251 | + # Check that the delegated roles were visited in the expected |
| 252 | + # order and the corresponding metadata files were persisted |
| 253 | + self.assertListEqual(sim.fetch_tracker.metadata, exp_calls) |
| 254 | + self._assert_files_exist(exp_files) |
259 | 255 | finally:
|
260 | 256 | self.teardown_subtest()
|
261 | 257 |
|
|
0 commit comments