~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/tests/test_signer.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
"""Tests for Signer."""
20
20
 
 
21
from nova.auth import signer
21
22
from nova import exception
22
23
from nova import test
23
 
from nova.auth import signer
24
24
 
25
25
 
26
26
class ClassWithStrRepr(object):
65
65
                                           'GET', 'server', '/foo'))
66
66
 
67
67
    def test_generate_invalid_signature_method_defined(self):
68
 
        self.assertRaises(exception.Error,
 
68
        self.assertRaises(exception.NovaException,
69
69
                          self.signer.generate,
70
70
                          {'SignatureVersion': '2',
71
71
                           'SignatureMethod': 'invalid_method'},
72
72
                          'GET', 'server', '/foo')
73
73
 
74
74
    def test_generate_no_signature_method_defined(self):
75
 
        self.assertRaises(exception.Error,
 
75
        self.assertRaises(exception.NovaException,
76
76
                          self.signer.generate,
77
77
                          {'SignatureVersion': '2'},
78
78
                          'GET', 'server', '/foo')
85
85
        # Create Signer again now that hashlib.sha256 is None
86
86
        self.signer = signer.Signer(
87
87
                        'uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o')
88
 
        self.assertRaises(exception.Error,
 
88
        self.assertRaises(exception.NovaException,
89
89
                          self.signer.generate,
90
90
                          {'SignatureVersion': '2',
91
91
                           'SignatureMethod': 'HmacSHA256'},
106
106
                              'GET', 'server', '/foo'))
107
107
 
108
108
    def test_generate_unknown_version(self):
109
 
        self.assertRaises(exception.Error,
 
109
        self.assertRaises(exception.NovaException,
110
110
                self.signer.generate,
111
111
                {'SignatureMethod': 'HmacSHA256', 'SignatureVersion': '9'},
112
112
                'GET', 'server', '/foo')