def test_model_repo_sync_cancelled(self, mock_cancel, *unused): # Setup conduit = TestConduit(1) # Test repository = Repository(REPO_ID) options = options={constants.PARENT_SETTINGS: PARENT_SETTINGS} repository.run_synchronization(None, conduit.cancelled, options) # Verify mock_cancel.assert_called_with(TASK_ID)
def test_model_repo_sync_cancelled(self, mock_cancel, *unused): # Setup conduit = TestConduit(1) # Test repository = Repository(REPO_ID) options = {constants.PARENT_SETTINGS: PARENT_SETTINGS} repository.run_synchronization(None, conduit.cancelled, options) # Verify mock_cancel.assert_called_with(TASK_ID)
def test_repository(self, *mocks): # Setup repository = Repository(REPO_ID) progress = Mock() cancelled = Mock(return_value=False) # Test options = { constants.MAX_DOWNLOAD_CONCURRENCY_KEYWORD: MAX_CONCURRENCY, constants.MAX_DOWNLOAD_BANDWIDTH_KEYWORD: MAX_BANDWIDTH, constants.PARENT_SETTINGS: PARENT_SETTINGS, } repository.run_synchronization(progress, cancelled, options) binding = mocks[1] key, certificate = Bundle.split(NODE_CERTIFICATE) expected_conf = { importer_constants.KEY_SSL_VALIDATION: False, importer_constants.KEY_MAX_DOWNLOADS: MAX_CONCURRENCY, importer_constants.KEY_MAX_SPEED: MAX_BANDWIDTH, importer_constants.KEY_SSL_CLIENT_KEY: key, importer_constants.KEY_SSL_CLIENT_CERT: certificate, } # Verify binding.assert_called_with(REPO_ID, expected_conf)