This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding logic for registering and updating consumers with client certs
This commit adds a new testcase for registering and updating a consumer. The Registering happens with basic auth url and the update is through the client certificate that is in the previous response. See pulp/pulp-smash#1007
- Loading branch information
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# coding=utf-8 | ||
"""Utility functions for Platform tests.""" | ||
from pulp_smash import api | ||
|
||
|
||
def make_client_with_cert_auth(cfg, cert=None): | ||
"""Make an API client configured with client certificate for authentication. | ||
Create a client that is configured with the client certificates. This will ensure | ||
that the authentication of the urls is through certificates rather than the | ||
basic authentication (i.e using `username` and `password`. | ||
This is made possible by ensuring the following: | ||
1. Create a client object in the normal way ``client = api.Client(cfg)``. | ||
2. Remove the authentication information from the client object. | ||
3. Add the client certificates in the client object. | ||
:param cfg: Information about a Pulp | ||
deployment. | ||
:param cert: Path to the Client Certificate file | ||
that is used for authenticating the client | ||
:returns: An API client configured with client certificates. | ||
""" | ||
client = api.Client(cfg) | ||
del client.request_kwargs['auth'] | ||
client.request_kwargs['cert'] = cert | ||
return client |