~0x44/nova/bug838466

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/test_auth.py

  • Committer: Michael Gundlach
  • Date: 2010-10-13 20:36:05 UTC
  • mto: This revision was merged to the branch mainline in revision 349.
  • Revision ID: michael.gundlach@rackspace.com-20101013203605-envsaw6pgu73mjud
Fix several problems keeping AuthMiddleware from functioning in the OpenStack API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
import nova.api
9
9
import nova.api.openstack.auth
 
10
import nova.auth.manager
10
11
from nova import auth
11
12
from nova.tests.api.openstack import fakes
12
13
 
26
27
 
27
28
    def test_authorize_user(self):
28
29
        f = fakes.FakeAuthManager()
29
 
        f.add_user('derp', { 'uid': 1, 'name':'herp' } )
 
30
        f.add_user('derp', nova.auth.manager.User(1, 'herp', None, None, None))
30
31
 
31
32
        req = webob.Request.blank('/v1.0/')
32
33
        req.headers['X-Auth-User'] = 'herp'
40
41
 
41
42
    def test_authorize_token(self):
42
43
        f = fakes.FakeAuthManager()
43
 
        f.add_user('derp', { 'uid': 1, 'name':'herp' } )
 
44
        f.add_user('derp', nova.auth.manager.User(1, 'herp', None, None, None))
44
45
            
45
46
        req = webob.Request.blank('/v1.0/')
46
47
        req.headers['X-Auth-User'] = 'herp'
71
72
            self.destroy_called = True
72
73
        
73
74
        def bad_token(meh, context, token_hash):
74
 
            return { 'token_hash':token_hash,  
75
 
                     'created_at':datetime.datetime(1990, 1, 1) }
 
75
            return fakes.FakeToken(
 
76
                    token_hash=token_hash,
 
77
                    created_at=datetime.datetime(1990, 1, 1))
76
78
 
77
79
        self.stubs.Set(fakes.FakeAuthDatabase, 'auth_destroy_token',
78
80
            destroy_token_mock)