def test__delete_dest_path_if_stale_up_to_date(self, mock_unlink): touch(self.master_path) os.link(self.master_path, self.dest_path) res = image_cache._delete_dest_path_if_stale(self.master_path, self.dest_path) self.assertFalse(mock_unlink.called) self.assertTrue(res)
def test__delete_dest_path_if_stale_out_of_date(self, mock_unlink): touch(self.master_path) touch(self.dest_path) res = image_cache._delete_dest_path_if_stale(self.master_path, self.dest_path) mock_unlink.assert_called_once_with(self.dest_path) self.assertFalse(res)
def test__delete_dest_path_if_stale_no_dest(self, mock_unlink): res = image_cache._delete_dest_path_if_stale(self.master_path, self.dest_path) self.assertFalse(mock_unlink.called) self.assertFalse(res)
def test__delete_dest_path_if_stale_no_master(self, mock_unlink): touch(self.dest_path) res = image_cache._delete_dest_path_if_stale(self.master_path, self.dest_path) mock_unlink.assert_called_once_with(self.dest_path) self.assertFalse(res)