def test_request_no_token_dummy(self):
        cms._ensure_subprocess()

        httpretty.register_uri(httpretty.GET, "%s/v2.0/certificates/ca" % BASE_URI, status=404)
        httpretty.register_uri(httpretty.GET, "%s/v2.0/certificates/signing" % BASE_URI, status=404)
        self.assertRaises(
            cms.subprocess.CalledProcessError, self.middleware.verify_signed_token, client_fixtures.SIGNED_TOKEN_SCOPED
        )
    def setUp(self, expected_env=None, auth_version=None,
              fake_app=None, fake_http=None, token_dict=None):
        testtools.TestCase.setUp(self)
        expected_env = expected_env or {}

        if token_dict:
            self.token_dict = token_dict
        else:
            self.token_dict = {
                'uuid_token_default': client_fixtures.UUID_TOKEN_DEFAULT,
                'uuid_token_unscoped': client_fixtures.UUID_TOKEN_UNSCOPED,
                'signed_token_scoped': client_fixtures.SIGNED_TOKEN_SCOPED,
                'signed_token_scoped_expired':
                client_fixtures.SIGNED_TOKEN_SCOPED_EXPIRED,
                'revoked_token': client_fixtures.REVOKED_TOKEN,
                'revoked_token_hash': client_fixtures.REVOKED_TOKEN_HASH
            }

        self.conf = {
            'auth_host': 'keystone.example.com',
            'auth_port': 1234,
            'auth_admin_prefix': '/testadmin',
            'signing_dir': client_fixtures.CERTDIR,
            'auth_version': auth_version
        }

        # Base assumes v2 for fake app and http, can be overridden for
        # child classes by called set_middleware() directly
        self.fake_app = fake_app or FakeApp
        self.fake_http = fake_http or FakeHTTPConnection
        self.set_middleware(self.fake_app, self.fake_http,
                            expected_env, self.conf)
        # self.middleware.verify_signed_token will call
        # _ensure_subprocess, but we need
        # cms.subprocess.CalledProcessError to be imported first.
        # Explicitly call _ensure_subprocess to make sure the import
        # happens before we need it regardless of test order.
        cms._ensure_subprocess()

        self.response_status = None
        self.response_headers = None

        signed_list = 'SIGNED_REVOCATION_LIST'
        valid_signed_list = 'VALID_SIGNED_REVOCATION_LIST'
        globals()[signed_list] = globals()[valid_signed_list]