mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-02 20:59:06 +08:00
Fix the unit tests
This commit is contained in:
1
Vagrantfile
vendored
1
Vagrantfile
vendored
@@ -20,6 +20,7 @@ $script = <<SCRIPT
|
||||
openssl-devel \
|
||||
python \
|
||||
python-devel \
|
||||
python2-dnf \
|
||||
python-docutils \
|
||||
python-flask \
|
||||
python-gobject-base \
|
||||
|
||||
@@ -20,6 +20,7 @@ RUN yum -y install \
|
||||
kobo-rpmlib \
|
||||
libmodulemd \
|
||||
python-backports-ssl_match_hostname \
|
||||
python-dnf \
|
||||
python-dogpile-cache \
|
||||
python-enum34 \
|
||||
python-flask \
|
||||
|
||||
@@ -13,6 +13,7 @@ RUN dnf -y install \
|
||||
python3-rpm \
|
||||
libmodulemd \
|
||||
python3-gobject \
|
||||
python3-dnf \
|
||||
python3-dogpile-cache \
|
||||
python3-flask \
|
||||
python3-flask-migrate \
|
||||
|
||||
@@ -1254,10 +1254,8 @@ class TestOfflineLocalBuilds:
|
||||
profiles = mmd.get_profiles()
|
||||
assert set(profiles.keys()) == set(["buildroot", "srpm-buildroot"])
|
||||
|
||||
@patch("module_build_service.utils.general.open", create=True)
|
||||
@patch("module_build_service.utils.general.open", create=True, new_callable=mock.mock_open)
|
||||
def test_import_builds_from_local_dnf_repos(self, patched_open):
|
||||
pytest.importorskip("dnf")
|
||||
|
||||
with patch("dnf.Base") as dnf_base:
|
||||
repo = mock.MagicMock()
|
||||
repo.repofile = "/etc/yum.repos.d/foo.repo"
|
||||
@@ -1265,9 +1263,7 @@ class TestOfflineLocalBuilds:
|
||||
repo.get_metadata_content.return_value = f.read()
|
||||
base = dnf_base.return_value
|
||||
base.repos = {"reponame": repo}
|
||||
|
||||
patched_open.return_value = mock.mock_open(
|
||||
read_data="FOO=bar\nPLATFORM_ID=platform:x\n").return_value
|
||||
patched_open.return_value.readlines.return_value = ('FOO=bar', 'PLATFORM_ID=platform:x')
|
||||
|
||||
module_build_service.utils.import_builds_from_local_dnf_repos()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user