-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend: add support for pulp domains
The pulp.stage.devshift.net instance has domains enabled while our STG instance has them disabled. As long as it is easy to support both cases, I'd do that.
- Loading branch information
Showing
2 changed files
with
65 additions
and
4 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,39 @@ | ||
""" | ||
Test Pulp client | ||
""" | ||
|
||
# pylint: disable=attribute-defined-outside-init | ||
|
||
from copr_backend.pulp import PulpClient | ||
|
||
|
||
class TestPulp: | ||
|
||
def setup_method(self, _method): | ||
self.config = { | ||
"api_root": "/pulp/", | ||
"base_url": "http://pulp.fpo:24817", | ||
"cert": "", | ||
"domain": "default", | ||
"dry_run": False, | ||
"format": "json", | ||
"key": "", | ||
"password": "1234", | ||
"timeout": 0, | ||
"username": "admin", | ||
"verbose": 0, | ||
"verify_ssl": True, | ||
} | ||
|
||
def test_url(self): | ||
client = PulpClient(self.config) | ||
assert self.config["domain"] == "default" | ||
assert client.url("api/v3/artifacts/")\ | ||
== "http://pulp.fpo:24817/pulp/api/v3/artifacts/" | ||
|
||
assert client.url("api/v3/repositories/rpm/rpm/?")\ | ||
== "http://pulp.fpo:24817/pulp/api/v3/repositories/rpm/rpm/?" | ||
|
||
self.config["domain"] = "copr" | ||
assert client.url("api/v3/artifacts/")\ | ||
== "http://pulp.fpo:24817/pulp/copr/api/v3/artifacts/" |