changeset 3427:0cc5867d57f5

theme._test.test_editbar_actions: tests actions for editbar dependend on valid user and email enabled
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 29 Mar 2008 21:36:55 +0100
parents 79dd730d6455
children a53f1e77d372
files MoinMoin/theme/_tests/test_editbar_actions.py
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/theme/_tests/test_editbar_actions.py	Sat Mar 29 21:36:55 2008 +0100
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""
+    MoinMoin - MoinMoin.theme Tests
+
+    @copyright: 2008 MoinMoin:ReimarBauer
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin.theme import ThemeBase
+from MoinMoin.Page import Page
+
+class TestEditBarActions(object):
+    def setup_method(self, method):
+        self.savedValid = self.request.user.valid
+        self.savedMailEnabled = self.request.cfg.mail_enabled
+        self.request.cfg.mail_enabled = True
+        self.page = Page(self.request, u'FrontPage')
+        self.ThemeBase = ThemeBase(self.request)
+
+    def teardown_method(self, method):
+        self.request.user.valid = self.savedValid
+        self.request.cfg.mail_enabled = self.savedMailEnabled
+
+    def test_editbar_for_anonymous_user(self):
+        assert not self.request.user.valid
+        assert not self.ThemeBase.subscribeLink(self.page)
+        assert not self.ThemeBase.quicklinkLink(self.page)
+
+    def test_editbar_for_valid_user(self):
+        self.request.user.valid = True
+        assert self.request.user.valid
+        assert 'subscribe' in self.ThemeBase.subscribeLink(self.page)
+        assert 'quicklink' in self.ThemeBase.quicklinkLink(self.page)
+
+coverage_modules = ['MoinMoin.theme']