view test/test_memorydb.py @ 6548:de5f5f9c02f2

Fix spurious content-ty on 304; xfail css Cache-Control Using wsgiref.validate.validator to verify http/wsgi responses. It discovered that a 304 was returning a content-type header but shouldn't. Fixed that. For some unknown reason I can't reproduce on my devel platform, travis-ci is throwing: > self.assertEqual(f.headers['Cache-Control'], 'public, max-age=4838400') E AssertionError: 'public, max-age=3600' != 'public, max-age=4838400' E - public, max-age=3600 E ? ^ E + public, max-age=4838400 E ? ++ ^^ in test_liveserver test_cache_control_css. I have no idea why this is happening. The 3600 value isn't in the code base or tracker template that I see. While I was trying to figure out if the wsgi server later was an issue, I came across the validator. Maybe it will throw some light on this error?
author John Rouillard <rouilj@ieee.org>
date Thu, 09 Dec 2021 20:11:58 -0500
parents 7f00fc5958ca
children 044dcf3608a2
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

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):
    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/