Commits

Olemis Lang committed 55d10e0

BH Multiproduct #355 : Added test cases about product boundaries regarding ticket API

  • Participants
  • Parent commits dab6189
  • Branches t355_trac_test_suite

Comments (0)

Files changed (1)

File t355/t355_r1437383_trac_test_ticket_api.diff

 # HG changeset patch
-# Parent 0de7786532d2b3a31d46b7e5d023858dd3c342be
+# Parent b4eb93330ef507b1561c97b8eb2f69d3fd9364c3
 BH Multiproduct #355 : Rewrite Trac test cases for ticket API so as to run them against product environments
 
-diff -r 0de7786532d2 bloodhound_multiproduct/tests/ticket/__init__.py
+diff -r b4eb93330ef5 bloodhound_multiproduct/tests/ticket/__init__.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/bloodhound_multiproduct/tests/ticket/__init__.py	Tue Jan 29 19:33:08 2013 -0500
++++ b/bloodhound_multiproduct/tests/ticket/__init__.py	Tue Feb 05 12:06:08 2013 -0500
 @@ -0,0 +1,20 @@
 +
 +#  Licensed to the Apache Software Foundation (ASF) under one
 +
 +"""Tests for Apache(TM) Bloodhound's tickets in product environments"""
 +
-diff -r 0de7786532d2 bloodhound_multiproduct/tests/ticket/api.py
+diff -r b4eb93330ef5 bloodhound_multiproduct/tests/ticket/api.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/bloodhound_multiproduct/tests/ticket/api.py	Tue Jan 29 19:33:08 2013 -0500
-@@ -0,0 +1,55 @@
++++ b/bloodhound_multiproduct/tests/ticket/api.py	Tue Feb 05 12:06:08 2013 -0500
+@@ -0,0 +1,70 @@
 +
 +#  Licensed to the Apache Software Foundation (ASF) under one
 +#  or more contributor license agreements.  See the NOTICE file
 +
 +import unittest
 +
-+from trac.perm import PermissionSystem
++from trac.perm import PermissionCache, PermissionSystem
 +from trac.test import Mock
 +from trac.ticket.api import TicketSystem
 +from trac.ticket.tests.api import TicketSystemTestCase
 +    def tearDown(self):
 +        self.global_env.reset_db()
 +
++    def test_available_actions_isolation(self):
++        # Grant TICKET_CREATE in product environment ...
++        self.perm.grant_permission('anonymous', 'TICKET_CREATE')
++        self.req.perm = PermissionCache(self.env)
++        self.assertEqual(['leave', 'reopen'],
++                         self._get_actions({'status': 'closed'}))
++
++        # ... but no perms in global environment
++        self.req.perm = PermissionCache(self.global_env)
++        product_env = self.env
++        try:
++            self.env = self.global_env
++            self.assertEqual(['leave'], self._get_actions({'status': 'closed'}))
++        finally:
++            self.env = product_env
 +
 +def test_suite():
 +    return unittest.TestSuite([