-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 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 |
---|---|---|
@@ -1,8 +1,28 @@ | ||
import urllib.parse | ||
|
||
import requests | ||
|
||
|
||
def _repo_url(repo, ssh_config): | ||
return urllib.parse.urlunparse(urllib.parse.urlparse(repo['full_path'])._replace(netloc=ssh_config['hostname'])) | ||
|
||
|
||
def test_foreman_organization(organization): | ||
assert organization | ||
|
||
def test_foreman_product(product): | ||
assert product | ||
|
||
def test_foreman_repository(repository): | ||
assert repository | ||
def test_foreman_yum_repository(yum_repository, foremanapi, ssh_config): | ||
assert yum_repository | ||
foremanapi.resource_action('repositories', 'sync', {'id': yum_repository['id']}) | ||
repo_url = _repo_url(yum_repository, ssh_config) | ||
assert requests.get(f'{repo_url}/repodata/repomd.xml', verify=False) | ||
assert requests.get(f'{repo_url}/Packages/b/bear-4.1-1.noarch.rpm', verify=False) | ||
|
||
|
||
def test_foreman_file_repository(file_repository, foremanapi, ssh_config): | ||
assert file_repository | ||
foremanapi.resource_action('repositories', 'sync', {'id': file_repository['id']}) | ||
repo_url = _repo_url(file_repository, ssh_config) | ||
assert requests.get(f'{repo_url}/1.iso', verify=False) |