259
259
pf.write('testing')
260
260
with patch('shutil.copyfile') as cf_mock:
261
261
with patch('candidate.run_command') as rc_mock:
262
publish_candidates(base_dir, '~/streams',
263
juju_release_tools='../')
262
with patch('candidate.extract_candidates') as ec_mock:
263
publish_candidates(base_dir, '~/streams',
264
juju_release_tools='../')
264
265
self.assertEqual(1, cf_mock.call_count)
265
266
output, args, kwargs = cf_mock.mock_calls[0]
266
267
self.assertEqual(package_path, args[0])
286
287
self.assertEqual({'dry_run': False, 'verbose': False}, kwargs)
288
args, kwargs = ec_mock.call_args
289
self.assertEqual((base_dir, ), args)
290
self.assertEqual({'dry_run': False, 'verbose': False}, kwargs)
288
292
def test_publish_candidates_with_dry_run(self):
289
293
with temp_dir() as base_dir:
290
294
artifacts_dir_path = os.path.join(base_dir, 'master-artifacts')
291
295
os.makedirs(artifacts_dir_path)
292
296
with patch('candidate.run_command') as rc_mock:
293
publish_candidates(base_dir, '~/streams',
294
juju_release_tools='../')
297
with patch('candidate.extract_candidates') as ec_mock:
299
base_dir, '~/streams', juju_release_tools='../',
300
dry_run=True, verbose=True)
295
301
self.assertEqual(2, rc_mock.call_count)
296
302
output, args, kwargs = rc_mock.mock_calls[0]
297
self.assertEqual({'dry_run': False, 'verbose': False}, kwargs)
303
self.assertEqual({'dry_run': True, 'verbose': True}, kwargs)
298
304
output, args, kwargs = rc_mock.mock_calls[1]
299
self.assertEqual({'dry_run': False, 'verbose': False}, kwargs)
305
self.assertEqual({'dry_run': True, 'verbose': True}, kwargs)
306
args, kwargs = ec_mock.call_args
307
self.assertEqual((base_dir, ), args)
308
self.assertEqual({'dry_run': True, 'verbose': True}, kwargs)