view test/test_memorydb.py @ 5272:c6fbd4803eae

If you upgrade to the newer query edit interface but did not allow users full access to search queries, the edit interface displays public queries that the user does not own in the section labeled "Queries I created". Updated upgrading.txt to discuss this problem and link back to the 1.4.17 upgrading instructions. Also included schema.py permissions that can be used to make the edit interface work correctly without allow full search access for queries. Updated the test script in the 1.4.17 upgrading instructions to display protected properties (like creator) to make dignosing this easier.
author John Rouillard <rouilj@ieee.org>
date Sat, 23 Sep 2017 13:05:48 -0400
parents 364c54991861
children 62de601bdf6f
line wrap: on
line source

import unittest, os, shutil, time

from roundup import hyperdb

from db_test_base import DBTest, ROTest, SchemaTest, config, setupSchema
import memorydb

class memorydbOpener:
    module = memorydb

    def nuke_database(self):
        # really kill it
        self.db = None

    db = None
    def open_database(self):
        if self.db is None:
            self.db = self.module.Database(config, 'admin')
        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()

    # 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 DBMTest
class memorydbSessionTest(memorydbOpener, DBMTest, unittest.TestCase):
    def setUp(self):
        self.db = self.module.Database(config, 'admin')
        setupSchema(self.db, 1, self.module)
        self.sessions = self.db.sessions

# vim: set filetype=python ts=4 sw=4 et si


Roundup Issue Tracker: http://roundup-tracker.org/