def register_keystone_v2_token_fixture(self):
     v2_token = ks_v2_fixture.Token(token_id=self.tokenid)
     service = v2_token.add_service('baremetal')
     service.add_endpoint('http://ironic.example.com', region='RegionOne')
     httpretty.register_uri(httpretty.POST,
                            '%s/tokens' % (keystone_client_fixtures.V2_URL),
                            body=json.dumps(v2_token))
Exemplo n.º 2
0
 def register_keystone_token_fixture(self, mreq):
     v2_token = ks_v2_fixture.Token(token_id='token')
     service = v2_token.add_service('application-catalog')
     service.add_endpoint('http://no.where', region='RegionOne')
     mreq.register_uri('POST',
                       'http://no.where/v2.0/tokens',
                       json=v2_token,
                       status_code=200)
def keystone_request_callback(request, uri, headers):
    response_headers = {"content-type": "application/json"}
    token_id = TOKENID
    if uri == BASE_URL:
        return (200, headers, V3_VERSION_LIST)
    elif uri == BASE_URL + "/v2.0":
        v2_token = ks_v2_fixture.Token(token_id)
        return (200, response_headers, json.dumps(v2_token))
    elif uri == BASE_URL + "/v3":
        v3_token = ks_v3_fixture.Token()
        response_headers["X-Subject-Token"] = token_id
        return (201, response_headers, json.dumps(v3_token))
Exemplo n.º 4
0
def setup_keystone_v2():
    v2_token = ks_v2_fixture.Token(token_id=TOKENID)
    service = v2_token.add_service('network')
    service.add_endpoint(PUBLIC_ENDPOINT_URL, region=REGION)

    httpretty.register_uri(httpretty.POST,
                           '%s/tokens' % (V2_URL),
                           body=json.dumps(v2_token))

    auth_session = session.Session()
    auth_plugin = ks_v2_auth.Password(V2_URL, 'xx', 'xx')
    return auth_session, auth_plugin