-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from rbikar/create-repo-distributor
Added support for Distributor when creating repository
- Loading branch information
Showing
3 changed files
with
172 additions
and
23 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 |
---|---|---|
@@ -1,16 +1,31 @@ | ||
from pubtools.pulplib import FakeController, Repository | ||
from pubtools.pulplib import FakeController, Repository, Distributor | ||
|
||
|
||
def test_create_repository(): | ||
"""Client.create_repository() with fake client adds new repositories to controller.""" | ||
controller = FakeController() | ||
|
||
client = controller.client | ||
repo_1 = client.create_repository(Repository(id="repo1")) | ||
repo_2 = client.create_repository(Repository(id="repo2")) | ||
repo_1 = client.create_repository( | ||
Repository( | ||
id="repo1", | ||
distributors=[Distributor(id="dist1", type_id="yum_distributor")], | ||
) | ||
) | ||
repo_2 = client.create_repository( | ||
Repository( | ||
id="repo2", | ||
distributors=[Distributor(id="dist2", type_id="yum_distributor")], | ||
) | ||
) | ||
|
||
# adding already existing repository has no effect | ||
_ = client.create_repository(Repository(id="repo1")) | ||
_ = client.create_repository( | ||
Repository( | ||
id="repo1", | ||
distributors=[Distributor(id="dist1", type_id="yum_distributor")], | ||
) | ||
) | ||
# The change should be reflected in the controller, | ||
# with two repositories present | ||
assert controller.repositories == [repo_1.result(), repo_2.result()] |
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