[STAGE5] Agent memory store + TTL/search tests
This commit is contained in:
1 parent
6cd7984910
commit
f2bdccc45b
3 files changed
+101
-1
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import os, sys, tempfile, unittest
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
from memory import put, get, search
|
||||
|
||||
class MemoryTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = tempfile.mktemp(suffix='.db')
|
||||
def test_put_get(self):
|
||||
put('stage5','camera','Frigate test',source='test',db=self.db)
|
||||
self.assertEqual(get('stage5','camera',db=self.db)['value'],'Frigate test')
|
||||
def test_search(self):
|
||||
put('stage5','event_bus','NATS JetStream',db=self.db)
|
||||
self.assertEqual(len(search('stage5','NATS',db=self.db)),1)
|
||||
def test_ttl(self):
|
||||
put('stage5','tmp','x',ttl=-1,db=self.db)
|
||||
self.assertIsNone(get('stage5','tmp',db=self.db))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user