forked from pulp/pulp_rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix server error when using gpgcheck/repo_gpgcheck
pulp#3298 moved gpg options to a single field called "repo_config", but the deprecated "gpgcheck" and "repo_gpgcheck" were still being passed to the models, which caused a TypeError when trying to use them. closes pulp#3357
- Loading branch information
Showing
3 changed files
with
81 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed server error when trying to create repository with deprecated `gpgcheck` and `repo_gpgcheck`. |
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,52 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"factory_kwargs,repo_config_result", | ||
[ | ||
({}, {}), | ||
({"gpgcheck": 0}, {"gpgcheck": 0}), | ||
({"repo_gpgcheck": 0}, {"repo_gpgcheck": 0}), | ||
({"gpgcheck": 0, "repo_gpgcheck": 0}, {"gpgcheck": 0, "repo_gpgcheck": 0}), | ||
({"gpgcheck": 1, "repo_gpgcheck": 1}, {"gpgcheck": 1, "repo_gpgcheck": 1}), | ||
], | ||
) | ||
def test_create_repo_with_deprecated_gpg_options_3357( | ||
rpm_repository_factory, factory_kwargs, repo_config_result | ||
): | ||
"""Can create repository with deprecated gpgcheck and repo_gpgcheck options.""" | ||
repo = rpm_repository_factory(**factory_kwargs) | ||
assert repo.repo_config == repo_config_result | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"original_repo_config,update_kwargs,repo_config_result", | ||
[ | ||
({}, {}, {}), | ||
({}, {"gpgcheck": 0}, {"gpgcheck": 0}), | ||
({}, {"repo_gpgcheck": 0}, {"repo_gpgcheck": 0}), | ||
({}, {"gpgcheck": 0, "repo_gpgcheck": 0}, {"gpgcheck": 0, "repo_gpgcheck": 0}), | ||
({}, {"gpgcheck": 1, "repo_gpgcheck": 1}, {"gpgcheck": 1, "repo_gpgcheck": 1}), | ||
( | ||
{"gpgcheck": 0, "repo_gpgcheck": 0}, | ||
{"gpgcheck": 1, "repo_gpgcheck": 1}, | ||
{"gpgcheck": 1, "repo_gpgcheck": 1}, | ||
), | ||
], | ||
) | ||
def test_update_repo_with_deprecated_gpg_options_3357( | ||
rpm_repository_factory, | ||
rpm_repository_api, | ||
original_repo_config, | ||
update_kwargs, | ||
repo_config_result, | ||
): | ||
"""Can update repository with deprecated gpgcheck and repo_gpgcheck options.""" | ||
original_repo = rpm_repository_factory(**original_repo_config) | ||
assert original_repo.repo_config == original_repo_config | ||
|
||
body = {"name": original_repo.name} | ||
body.update(update_kwargs) | ||
rpm_repository_api.update(original_repo.pulp_href, body) | ||
updated_repo = rpm_repository_api.read(original_repo.pulp_href) | ||
assert updated_repo.repo_config == repo_config_result |