add method for updating head (=index) fields; test shell script; more postgrs tests

This commit is contained in:
Helmut Merz 2024-05-03 12:43:21 +02:00
parent 5044978acc
commit 6099db6c56
3 changed files with 20 additions and 6 deletions

3
runtests.sh Executable file
View file

@ -0,0 +1,3 @@
python tests/test_postgres.py
python tests/test_standard.py

View file

@ -54,11 +54,6 @@ class Track(object):
else:
self.data.update(data)
def storeTrack(self):
"""Make changes of this track persistent by updating the corresponding row
in its container."""
self.container.update(self)
@property
def uid(self):
if self.trackId is None:
@ -78,6 +73,16 @@ class Track(object):
return dict(uid=self.uid, head=self.head, data=self.data,
timeStamp=str(self.timeStamp)[:19])
# shortcuts for compatibility with existing software:
def updateIndex(self, **kw):
for k, v in kw.items():
self.set(k, v)
self.storeTrack()
def storeTrack(self):
self.container.update(self)
@registerContainerClass
class Container(object):

View file

@ -23,6 +23,12 @@ class Test(unittest.TestCase):
def test_002_folder(self):
tlib_storage.test_folder(self, config)
def test_003_type(self):
tlib_storage.test_type(self, config)
def test_004_topic(self):
tlib_storage.test_topic(self, config)
def suite():
return unittest.TestSuite((
unittest.TestLoader().loadTestsFromTestCase(Test),