Fix the unit tests

This commit is contained in:
mprahl
2019-04-03 14:40:52 -04:00
parent 06e903c3c1
commit bc2a1e8d3c
4 changed files with 5 additions and 6 deletions

1
Vagrantfile vendored
View File

@@ -20,6 +20,7 @@ $script = <<SCRIPT
openssl-devel \
python \
python-devel \
python2-dnf \
python-docutils \
python-flask \
python-gobject-base \

View File

@@ -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 \

View File

@@ -13,6 +13,7 @@ RUN dnf -y install \
python3-rpm \
libmodulemd \
python3-gobject \
python3-dnf \
python3-dogpile-cache \
python3-flask \
python3-flask-migrate \

View File

@@ -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()