diff --git a/tests/db/sync/test_init.py b/tests/db/sync/test_init.py index 9c35143788ca53dc572e07eda81c54467bbfd8b6..7812689862a50eaddd3bd91e91a712656f5cfa44 100644 --- a/tests/db/sync/test_init.py +++ b/tests/db/sync/test_init.py @@ -333,22 +333,20 @@ class SynchronizerTests(SyncTestCase): class ModuleTests(TestCase): - @patch.multiple('rattail.db.sync', edbob=DEFAULT, get_engines=DEFAULT) - def test_get_sync_engines(self, edbob, get_engines): - - # nothing configured - edbob.config.get.return_value = None - self.assertTrue(sync.get_sync_engines() is None) - - # fake config with 2 out of 3 engines synced - get_engines.return_value = { - 'one': 'first', - 'two': 'second', - 'three': 'third', - } - edbob.config.get.return_value = 'one, two' - engines = sync.get_sync_engines() - self.assertEqual(engines, {'one': 'first', 'two': 'second'}) + def test_get_sync_engines(self): + config = Mock() + config.get.return_value = None + self.assertIsNone(sync.get_sync_engines(config)) + + with patch('rattail.db.sync.get_engines') as get_engines: + get_engines.return_value = { + 'one': 'first', + 'two': 'second', + 'three': 'third', + } + config.get.return_value = 'one, two' + self.assertEqual(sync.get_sync_engines(config), {'one': 'first', 'two': 'second'}) + get_engines.assert_called_once_with(config) @patch.multiple('rattail.db.sync', edbob=DEFAULT, Synchronizer=DEFAULT) def test_synchronize_changes(self, edbob, Synchronizer):