def mock_storage(target = None): if target: target._ws.stop() sh = StorageHandler(STORAGE) sh._ws = Mock('send') return sh
def testWrongMessage(self): self.store = StorageHandler() # The first should not raise, but catch and log the error self.store.set("storage.command.set.foo", { 'omg_wrong_key' : 'deep' }) with self.assertRaises(KeyError): # But this one should raise self.store._store['foo']
def testEmptyStorage(self): self.store = StorageHandler() self.store._ws = Mock('send') self.assertEqual(self.store._store, {})