def test_insert_raw(self): image = cStringIO.StringIO(testutils.random_binary_data(4096)) response = self.cache.insert_raw(image) self.assertNotEqual(response, None, "cache.insert_raw should return a tuple") stamp, hash_ = response self.assertTrue(hash_ in self.cache, hash_ + " should be in cache") items = self.cache.list() self.assertTrue((stamp, hash_) in items, str((stamp, hash_)) + " should be in cache.list(): " + str(items))
def test_insert(self): image = cStringIO.StringIO(testutils.random_binary_data(4096)) response = self.cache.insert_raw(('<;)', image)) self.assertNotEqual(response, None, 'cache.insert should return a tuple') emoticon, hash_ = response self.assertTrue(hash_ in self.cache, hash_ + ' should be in cache') items = self.cache.list() self.assertTrue((emoticon, hash_) in items, str((emoticon, hash_)) + ' should be in cache.list(): ' + str(items))
def test_last(self): image = cStringIO.StringIO(testutils.random_binary_data(4096)) response = self.cache.insert_raw(image) self.assertNotEqual(response, None, "cache.insert_raw should return a tuple") self.assertTrue("last" in self.cache, "last should be in cache")
def test_last(self): image = cStringIO.StringIO(testutils.random_binary_data(4096)) response = self.cache.insert_raw(image) self.assertNotEqual(response, None, 'cache.insert_raw should return a tuple') self.assertTrue('last' in self.cache, 'last should be in cache')