view MoinMoin/_tests/ @ 1973:286e315935ae

refactor usage of constants don't import from config module, but from constants.* use uppercase for constant names
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 10 Feb 2013 22:50:21 +0100
parents ff503e7ea7a0
children 87272c032485
line wrap: on
line source
# Copyright: 2009 by MoinMoin:ChristopherDenter
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

    MoinMoin - Tests for our test environment

from StringIO import StringIO

import pytest

from flask import current_app as app
from flask import g as flaskg

from MoinMoin.conftest import init_test_app, deinit_test_app
from MoinMoin.constants.keys import NAME, CONTENTTYPE
from import NoSuchItemError

from MoinMoin._tests import wikiconfig

class TestStorageEnvironWithoutConfig(object):
    def setup_method(self, method):
        self.class_level_value = 123

    def test_fresh_backends(self):
        assert self.class_level_value == 123

        assert isinstance(app.cfg, wikiconfig.Config)

        storage =
        assert storage
        assert hasattr(storage, '__getitem__')
        itemname = u"this item shouldn't exist yet"
        assert not storage.has_item(itemname)
        item = storage[itemname]
        new_rev = item.store_revision({NAME: [itemname, ], CONTENTTYPE: u'text/plain'}, StringIO(''))
        assert storage.has_item(itemname)

        before="+All:write", # need to write to sys pages

class TestStorageEnvironWithConfig(object):

    class Config(wikiconfig.Config):
        content_acl = CONTENT_ACL

    def test_config(self):
        assert isinstance(app.cfg, wikiconfig.Config)
        assert app.cfg.content_acl == CONTENT_ACL