Mercurial > p > roundup > code
view test/test_memorydb.py @ 7971:fe0348bbe45b
issue2551353 - Add roundup-classhelper for 2.4.0 release
Changes to the classic template are not done yet. Still testing.
This commit has document updates and changes to rest.py.
rest.py:
add /rest/data/user/role endpoint to core so the user doesn't have
to add the /rest/roles endpoint via interfaces.py. It will only send
roles for a user with Admin role and there is no way to override
this currently.
acknowledgements.txt:
Added members of team3 to other contributors. Specified for all
other contributes what they worked on.
upgrading.txt:
added classhelper section and basic template change
directions. Linked to admin_guide for full directions.
admin_guide.txt:
documented install, translation, troubleshooting, config etc.
user_guide.txt:
added section on using the classhelper. Added reference to section
earlier in the doc. Added image for section.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 21 May 2024 01:17:28 -0400 |
| parents | 2ce855803633 |
| children |
line wrap: on
line source
import unittest, os, shutil, time from roundup import hyperdb from .db_test_base import DBTest, ROTest, SchemaTest, config, setupSchema from roundup.test import memorydb from roundup.anypy import strings class memorydbOpener: module = memorydb def nuke_database(self): # really kill it memorydb.db_nuke('') self.db = None db = None def open_database(self, user='admin'): if self.db: self.db.close() self.db = self.module.Database(config, user) return self.db def setUp(self): self.open_database() setupSchema(self.db, 1, self.module) def tearDown(self): if self.db is not None: self.db.close() self.db = None self.nuke_database() # nuke and re-create db for restore def nukeAndCreate(self): self.db.close() self.nuke_database() self.db = self.module.Database(config, 'admin') setupSchema(self.db, 0, self.module) class memorydbDBTest(memorydbOpener, DBTest, unittest.TestCase): pass class memorydbROTest(memorydbOpener, ROTest, unittest.TestCase): def setUp(self): self.db = self.module.Database(config) setupSchema(self.db, 0, self.module) class memorydbSchemaTest(memorydbOpener, SchemaTest, unittest.TestCase): pass from .session_common import SessionTest class memorydbSessionTest(memorydbOpener, SessionTest, unittest.TestCase): s2b = lambda x,y: strings.s2b(y) def setUp(self): self.db = self.module.Database(config, 'admin') setupSchema(self.db, 1, self.module) self.sessions = self.db.sessions self.db.Session = self.sessions self.otks = self.db.otks self.db.Otk = self.otks def get_ts(self): return (self.sessions.get('random_session', '__timestamp'),) def testDbType(self): self.assertIn("memorydb", repr(self.db)) self.assertIn("{}", repr(self.db.Session)) # vim: set filetype=python ts=4 sw=4 et si
