Ejemplo n.º 1
0
 def read_value(self, device, address):
     if device == "randint":
         a, b = address.split(",")
         result = random.randint(int(a), int(b))
     else:
         result = cache.get(self._key(device, address), None)
     return result
Ejemplo n.º 2
0
 def test_cache(self):
     from collector.helpers import cache
     rc = cache.set('test_key', 'test_value')
     self.assertNotEqual(0, rc)
     
     value = cache.get('test_key', 'default_value')
     self.assertEqual('test_value', value)
Ejemplo n.º 3
0
 def read_value(self, device, address):
     if device == 'randint':
         a, b = address.split(",")
         result = random.randint(int(a), int(b))
     else:
         result = cache.get(self._key(device, address), None)
     return result
Ejemplo n.º 4
0
    def test_cache(self):
        from collector.helpers import cache
        rc = cache.set('test_key', 'test_value')
        self.assertNotEqual(0, rc)

        value = cache.get('test_key', 'default_value')
        self.assertEqual('test_value', value)