예제 #1
0
    def test_forget_with_missing_file(self):
        store = FileStore(tempfile.gettempdir())
        md5 = hashlib.md5(encode('foo')).hexdigest()
        full_dir = os.path.join(tempfile.gettempdir(), md5[0:2], md5[2:4])
        full_path = os.path.join(full_dir, md5)

        mock = flexmock(os.path)
        mock.should_receive('exists').once().with_args(full_path).and_return(False)

        self.assertFalse(store.forget('foo'))
예제 #2
0
    def test_forget_with_missing_file(self):
        store = FileStore(self._dir)

        sha = hashlib.sha256(encode('foo')).hexdigest()
        full_dir = os.path.join(self._dir, sha[0:2], sha[2:4], sha[4:6],
                                sha[6:8], sha[8:10], sha[10:12], sha[12:14],
                                sha[14:16])
        full_path = os.path.join(full_dir, sha)

        mock = flexmock(os.path)
        mock.should_receive('exists').once().with_args(full_path).and_return(
            False)

        self.assertFalse(store.forget('foo'))