diff options
| author | Thiago da Silva <thiago@redhat.com> | 2013-11-15 17:13:53 -0500 | 
|---|---|---|
| committer | Luis Pabon <lpabon@redhat.com> | 2013-11-19 19:10:36 -0800 | 
| commit | f8ae648c6d557689c8c67caef6a2c6b034b7aaba (patch) | |
| tree | 23a68b68446b407eb56bc5ab3751563eabdd2d47 /test/unit/common | |
| parent | c6d7ddc4bcdefbe7e30946c5c7eb26e74ad0ff0e (diff) | |
fix error with swauth-clean-tokens
Error is caused by left-over code from swauth. It had hard-coded
the auth account to .auth. Changed code to use volume specified
in the config file
Change-Id: Id00eb3964b6b26a84511e4753ab80b2dea5654da
Signed-off-by: Thiago da Silva <thiago@redhat.com>
Reviewed-on: http://review.gluster.org/6280
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'test/unit/common')
| -rw-r--r-- | test/unit/common/middleware/gswauth/swauth/test_middleware.py | 34 | 
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/common/middleware/gswauth/swauth/test_middleware.py b/test/unit/common/middleware/gswauth/swauth/test_middleware.py index 9ecd7d6..46d634f 100644 --- a/test/unit/common/middleware/gswauth/swauth/test_middleware.py +++ b/test/unit/common/middleware/gswauth/swauth/test_middleware.py @@ -804,6 +804,40 @@ class TestAuth(unittest.TestCase):          self.assertEquals(resp.status_int, 500)          self.assertEquals(self.test_auth.app.calls, 2) +    def test_get_token_for_auth_acct_success(self): +        local_auth = \ +            auth.filter_factory({ +                'super_admin_key': 'supertest', +                'metadata_volume': 'gsmd', +                'token_life': str(DEFAULT_TOKEN_LIFE), +                'max_token_life': str(MAX_TOKEN_LIFE)})(FakeApp()) +        resp = Request.blank( +            '/auth/v1.0', +            environ={'REQUEST_METHOD': 'GET', +                     'swift.cache': FakeMemcache()}, +            headers={'X-Auth-User': 'act:.super_admin', +                     'X-Auth-Key': 'supertest'}).get_response(local_auth) +        self.assertEquals(resp.status_int, 200) +        itk = resp.headers.get('x-auth-token') +        self.assertTrue(itk.startswith('AUTH_itk'), itk) +        self.assertEquals(resp.headers.get('x-storage-url'), +                          'http://127.0.0.1:8080/v1/AUTH_gsmd') + +    def test_get_token_for_auth_acct_fail_passwd(self): +        local_auth = \ +            auth.filter_factory({ +                'super_admin_key': 'supertest', +                'metadata_volume': 'gsmd', +                'token_life': str(DEFAULT_TOKEN_LIFE), +                'max_token_life': str(MAX_TOKEN_LIFE)})(FakeApp()) +        resp = Request.blank( +            '/auth/v1.0', +            environ={'REQUEST_METHOD': 'GET', +                     'swift.cache': FakeMemcache()}, +            headers={'X-Auth-User': 'act:.super_admin', +                     'X-Auth-Key': 'invalidpasswd'}).get_response(local_auth) +        self.assertEquals(resp.status_int, 401) +      def test_get_token_success_v1_0(self):          self.test_auth.app = FakeApp(iter([              # GET of user object  | 
