예제 #1
0
    def test_get_with_json_serializer(self):
        store = FileStore(self._dir)
        store.set_serializer(JsonSerializer())
        store.forever('foo', {'foo': 'bar'})

        result = store.get('foo')
        assert result == {'foo': 'bar'}
예제 #2
0
    def test_none_is_returned_if_file_doesnt_exist(self):
        mock = flexmock(os.path)
        mock.should_receive('exists').once().and_return(False)

        store = FileStore(tempfile.gettempdir())

        self.assertIsNone(store.get('foo'))
예제 #3
0
    def test_none_is_returned_if_file_doesnt_exist(self):
        mock = flexmock(os.path)
        mock.should_receive('exists').once().and_return(False)

        store = FileStore(tempfile.gettempdir())

        self.assertIsNone(store.get('foo'))