~gandelman-a/ubuntu/precise/keystone/UCA_2012.2.1

« back to all changes in this revision

Viewing changes to tests/test_content_types.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Soren Hansen, Logan Rosen, Chuck Short
  • Date: 2012-09-07 13:04:01 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20120907130401-o49wh9xxkr2cmuqx
Tags: 2012.2~rc1~20120906.2517-0ubuntu2
[ Adam Gandelman ]
* Refreshed patches.

[ Soren Hansen ]
* Update debian/watch to account for symbolically named tarballs and
  use newer URL.
* Fix Launchpad URLs in debian/watch.

[ Logan Rosen ]
* Fix control file to suggest python-memcache instead of python-memcached
  (LP: #998991).

[ Chuck Short ]
* New upstream version.
* Dont FTBFS if the testsuite fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
 
221
221
    def public_request(self, port=None, **kwargs):
222
222
        kwargs['port'] = port or self._public_port()
223
 
        return self.restful_request(**kwargs)
 
223
        response = self.restful_request(**kwargs)
 
224
        self.assertValidResponseHeaders(response)
 
225
        return response
224
226
 
225
227
    def admin_request(self, port=None, **kwargs):
226
228
        kwargs['port'] = port or self._admin_port()
227
 
        return self.restful_request(**kwargs)
 
229
        response = self.restful_request(**kwargs)
 
230
        self.assertValidResponseHeaders(response)
 
231
        return response
228
232
 
229
233
    def get_scoped_token(self):
230
234
        """Convenience method so that we can test authenticated requests."""
621
625
            'user_id': uuid.uuid4().hex,
622
626
        }
623
627
 
624
 
        self.admin_request(path=path, expected_status=401)
 
628
        r = self.admin_request(path=path, expected_status=401)
625
629
        self.assertValidErrorResponse(r)
626
630
 
 
631
    def test_fetch_revocation_list_nonadmin_fails(self):
 
632
        self.admin_request(
 
633
            method='GET',
 
634
            path='/v2.0/tokens/revoked',
 
635
            expected_status=401)
 
636
 
 
637
    def test_fetch_revocation_list_admin_200(self):
 
638
        token = self.get_scoped_token()
 
639
        try:
 
640
            r = self.restful_request(
 
641
                method='GET',
 
642
                path='/v2.0/tokens/revoked',
 
643
                token=token,
 
644
                expected_status=200,
 
645
                port=self._admin_port())
 
646
        except:
 
647
            raise nose.exc.SkipTest('Disabled by ubuntu patch')
 
648
        self.assertValidRevocationListResponse(r)
 
649
 
 
650
    def assertValidRevocationListResponse(self, response):
 
651
        self.assertIsNotNone(response.body['signed'])
 
652
 
627
653
 
628
654
class XmlTestCase(RestfulTestCase, CoreApiTests):
629
655
    xmlns = 'http://docs.openstack.org/identity/api/v2.0'