~ubuntu-branches/ubuntu/raring/cinder/raring-updates

« back to all changes in this revision

Viewing changes to cinder/tests/test_policy.py

Tags: upstream-2013.1~g2
ImportĀ upstreamĀ versionĀ 2013.1~g2

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    License for the specific language governing permissions and limitations
16
16
#    under the License.
17
17
 
18
 
"""Test of Policy Engine For Cinder"""
 
18
"""Test of Policy Engine For Cinder."""
19
19
 
20
20
import os.path
21
21
import StringIO
147
147
        # NOTE(dprince) we mix case in the Admin role here to ensure
148
148
        # case is ignored
149
149
        admin_context = context.RequestContext('admin',
150
 
                                                'fake',
151
 
                                                roles=['AdMiN'])
 
150
                                               'fake',
 
151
                                               roles=['AdMiN'])
152
152
        policy.enforce(admin_context, lowercase_action, self.target)
153
153
        policy.enforce(admin_context, uppercase_action, self.target)
154
154
 
180
180
 
181
181
    def test_policy_called(self):
182
182
        self.assertRaises(exception.PolicyNotAuthorized, policy.enforce,
183
 
                self.context, "example:exist", {})
 
183
                          self.context, "example:exist", {})
184
184
 
185
185
    def test_not_found_policy_calls_default(self):
186
186
        policy.enforce(self.context, "example:noexist", {})
188
188
    def test_default_not_found(self):
189
189
        self._set_brain("default_noexist")
190
190
        self.assertRaises(exception.PolicyNotAuthorized, policy.enforce,
191
 
                self.context, "example:noexist", {})
 
191
                          self.context, "example:noexist", {})
192
192
 
193
193
 
194
194
class ContextIsAdminPolicyTestCase(test.TestCase):