Commits

Olemis Lang committed 304fc9a

BH Multiproduct #667 : Initial test case candidate for revoking all user perms

Comments (0)

Files changed (1)

t667/t667_r1526822_error_mainnav.tests.diff

 # HG changeset patch
-# Parent 83b9192eb22cbaba893b29facb8149ed4e693d85
+# Parent 3fa75fea0997e4f0d3592120020134a168841164
 BH Multiproduct #667 : Test case for mainnav error
 
+diff -r 3fa75fea0997 bloodhound_multiproduct/tests/functional/admin.py
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/bloodhound_multiproduct/tests/functional/admin.py	Tue Oct 01 19:00:41 2013 -0500
+@@ -0,0 +1,62 @@
++# -*- coding: utf-8 -*-
++#
++#  Licensed to the Apache Software Foundation (ASF) under one
++#  or more contributor license agreements.  See the NOTICE file
++#  distributed with this work for additional information
++#  regarding copyright ownership.  The ASF licenses this file
++#  to you under the Apache License, Version 2.0 (the
++#  "License"); you may not use this file except in compliance
++#  with the License.  You may obtain a copy of the License at
++#
++#   http://www.apache.org/licenses/LICENSE-2.0
++#
++#  Unless required by applicable law or agreed to in writing,
++#  software distributed under the License is distributed on an
++#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++#  KIND, either express or implied.  See the License for the
++#  specific language governing permissions and limitations
++#  under the License.
++
++from uuid import uuid4
++
++from trac.perm import PermissionSystem
++from trac.tests import contentgen
++from trac.tests import functional
++from trac.tests.functional.tester import tc
++
++import unittest
++
++#----------------
++# Functional test cases for admin web UI & CLI
++#----------------
++
++class RegressionTestBhTicket667(functional.FunctionalTwillTestCaseSetup):
++    def runTest(self):
++        """No error after removing all permissions
++        """
++        # FIXME : Do not cheat and retrieve perms list by scrapping web UI
++        env = self._testenv.get_trac_environment()
++        actions = PermissionSystem(env).get_actions()
++
++        tester = self._tester
++        prefix = tester.create_product()
++
++        # Revoke all actions for 'user'
++        for action in actions:
++            self._testenv._tracadmin('permission', 'remove', 'user', action,
++                                     product=prefix)
++        with tester.as_user('user'):
++            self.go_to_home()
++
++
++def functionalSuite(suite=None):
++    if not suite:
++        import tests.functional
++        suite = tests.functional.functionalSuite()
++
++    suite.addTest(RegressionTestBhTicket667())
++    return suite
++
++if __name__ == '__main__':
++    unittest.main(defaultTest='functionalSuite')
++