Esempio n. 1
0
    def test_manager(self):
        '''Test the manager'''
        manager = RedisManager(RedisModel)
        obj = self._create_sample_instance()
        obj.save()

        fetched_object = manager.get(obj.key)
        self.assertIsInstance(fetched_object, RedisModel)
Esempio n. 2
0
    def test_pickling(self):
        '''We create a Python Object and save it to redis with pickle'''
        from datetime import datetime
        test_dict = dict(date=datetime.today(),
                         str_value="foo",
                         float_value=3456.34)

        obj = self._create_sample_instance(test_dict)
        obj.save()
        manager = RedisManager(RedisModel)
        fetched_object = manager.get(obj.key)
        self.assertEquals(fetched_object.value, test_dict)