Allow save to be called more than once
Replace check for single call with ensuring that it is called at least once. As mock patching affects global state by patching the class rather than the instance, other tests creating the CacheStorage object via separate test threads can result in the 'save' method being called more than once. Therefore just test to ensure that it has been called at least once. Change-Id: Ice3d13536bafa04713f4c226273898806926067d
This commit is contained in:
@@ -32,7 +32,7 @@ class TestCaseCacheStorage(testtools.TestCase):
|
||||
with mock.patch('jenkins_jobs.builder.CacheStorage.save') as save_mock:
|
||||
with mock.patch('os.path.isfile', return_value=False):
|
||||
jenkins_jobs.builder.CacheStorage("dummy")
|
||||
save_mock.assert_called_once_with()
|
||||
save_mock.assert_called_with()
|
||||
|
||||
@mock.patch('jenkins_jobs.builder.CacheStorage.get_cache_dir',
|
||||
lambda x: '/bad/file')
|
||||
|
||||
Reference in New Issue
Block a user