Beispiel #1
0
 def test_FetchDevices(self):
     store = HDStore({"config": {"filesdir": "/tmp/hd40test"}})
     store.write("Device_" + str(self._deviceA["_id"]), self._deviceA)
     store.write("Device_" + str(self._deviceB["_id"]), self._deviceB)
     devices = store.fetchDevices()
     count = 0
     for key in devices:
         count += 1
     self.assertEqual(2, count)
Beispiel #2
0
 def test_FetchDevices(self):
     store = HDStore({'config': {'filesdir': '/tmp/hd40test'}})
     store.write('Device_' + str(self._deviceA['_id']), self._deviceA)
     store.write('Device_' + str(self._deviceB['_id']), self._deviceB)
     devices = store.fetchDevices()
     count = 0
     for key in devices:
         count += 1
     self.assertEqual(2, count)
Beispiel #3
0
    def test_readWrite(self):
        key = "readkey-" + self._token
        store = HDStore()
        store.write(key, self._data)
        data = store.read(key)
        self.assertEqual(data, self._data)

        # Verify data is cached
        data = store._Cache.read(key)
        self.assertEqual(data, self._data)

        # Verify data is on disk
        exists = os.path.isfile(os.path.join(store._directory, key + ".json"))
        self.assertTrue(exists)
Beispiel #4
0
    def test_readWrite(self):
        key = 'readkey-' + self._token
        store = HDStore()
        store.write(key, self._data)
        data = store.read(key)
        self.assertEqual(data, self._data)

        # Verify data is cached
        data = store._Cache.read(key)
        self.assertEqual(data, self._data)

        # Verify data is on disk
        exists = os.path.isfile(os.path.join(store._directory, key + '.json'))
        self.assertTrue(exists)