def test_updated_return_when_cache_file_does_not_exist(self): ''' Tests that the updated function returns None when the cache key file doesn't exist. ''' with patch('os.path.isfile', MagicMock(return_value=False)): self.assertIsNone(localfs.updated(bank='', key='', cachedir=''))
def test_updated_return_when_cache_file_does_not_exist(self): """ Tests that the updated function returns None when the cache key file doesn't exist. """ with patch("os.path.isfile", MagicMock(return_value=False)): self.assertIsNone(localfs.updated(bank="", key="", cachedir=""))
def test_updated_success(self): """ Test that the updated function returns the modification time of the cache file """ # Create a temporary cache dir tmp_dir = tempfile.mkdtemp(dir=integration.SYS_TMP_DIR) # Use the helper function to create the cache file using localfs.store() self._create_tmp_cache_file(tmp_dir, salt.payload.Serial(self)) with patch("os.path.join", MagicMock(return_value=tmp_dir + "/bank/key.p")): self.assertIsInstance(localfs.updated(bank="bank", key="key"), int)
def test_updated_success(self): ''' Test that the updated function returns the modification time of the cache file ''' # Create a temporary cache dir tmp_dir = tempfile.mkdtemp(dir=TMP) # Use the helper function to create the cache file using localfs.store() self._create_tmp_cache_file(tmp_dir, salt.payload.Serial(self)) with patch('os.path.join', MagicMock(return_value=tmp_dir + '/bank/key.p')): self.assertIsInstance(localfs.updated(bank='bank', key='key', cachedir=tmp_dir), int)
def test_updated_success(self): """ Test that the updated function returns the modification time of the cache file """ # Create a temporary cache dir tmp_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP) # Use the helper function to create the cache file using localfs.store() self._create_tmp_cache_file(tmp_dir, salt.payload.Serial(self)) with patch("os.path.join", MagicMock(return_value=tmp_dir + "/bank/key.p")): self.assertIsInstance( localfs.updated(bank="bank", key="key", cachedir=tmp_dir), int )
def test_updated_return_when_cache_file_does_not_exist(self): ''' Tests that the updated function returns None when the cache key file doesn't exist. ''' self.assertIsNone(localfs.updated(bank='', key='', cachedir=''))
def test_updated_return_when_cache_file_does_not_exist(self): """ Tests that the updated function returns None when the cache key file doesn't exist. """ self.assertIsNone(localfs.updated(bank="", key=""))