add method for updating head (=index) fields; test shell script; more postgrs tests
This commit is contained in:
		
							parent
							
								
									5044978acc
								
							
						
					
					
						commit
						6099db6c56
					
				
					 3 changed files with 20 additions and 6 deletions
				
			
		
							
								
								
									
										3
									
								
								runtests.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								runtests.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,3 @@ | ||||||
|  | 
 | ||||||
|  | python tests/test_postgres.py | ||||||
|  | python tests/test_standard.py | ||||||
|  | @ -54,11 +54,6 @@ class Track(object): | ||||||
|         else: |         else: | ||||||
|             self.data.update(data) |             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 |     @property | ||||||
|     def uid(self): |     def uid(self): | ||||||
|         if self.trackId is None: |         if self.trackId is None: | ||||||
|  | @ -78,6 +73,16 @@ class Track(object): | ||||||
|         return dict(uid=self.uid, head=self.head, data=self.data,  |         return dict(uid=self.uid, head=self.head, data=self.data,  | ||||||
|                     timeStamp=str(self.timeStamp)[:19]) |                     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 | @registerContainerClass | ||||||
| class Container(object): | class Container(object): | ||||||
|  |  | ||||||
|  | @ -23,6 +23,12 @@ class Test(unittest.TestCase): | ||||||
|     def test_002_folder(self): |     def test_002_folder(self): | ||||||
|         tlib_storage.test_folder(self, config) |         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(): | def suite(): | ||||||
|     return unittest.TestSuite(( |     return unittest.TestSuite(( | ||||||
|         unittest.TestLoader().loadTestsFromTestCase(Test), |         unittest.TestLoader().loadTestsFromTestCase(Test), | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue