예제 #1
0
 def test_list_read(self):
     ins_redis = self.mock_redis.return_value
     ins_redis.llen.return_value = 1
     ins_redis.lrange.return_value = "value"
     real = shm.Shm()
     self.assertEquals('value', real.list_read("key"))
     ins_redis.lrange.assert_called_once_with("key", 0, 1)
예제 #2
0
 def test_delete(self):
     ins_redis = self.mock_redis.return_value
     ins_redis.delete.return_value = 'value'
     real = shm.Shm()
     self.assertEquals('value', real.delete("key"))
     ins_redis.delete.assert_called_once_with("key")
예제 #3
0
 def test_list_delete_value(self):
     ins_redis = self.mock_redis.return_value
     ins_redis.lrem.return_value = 'value'
     real = shm.Shm()
     self.assertEquals('value', real.list_delete_value("key", "value"))
     ins_redis.lrem.assert_called_once_with("key", 1, "value")
예제 #4
0
 def test_list_write(self):
     ins_redis = self.mock_redis.return_value
     ins_redis.rpush.return_value = 'value'
     real = shm.Shm()
     self.assertEquals('value', real.list_write("key", "value"))
     ins_redis.rpush.assert_called_once_with("key", "value")