2021-01-08 13:41:50 +01:00
|
|
|
From 81f38c8cb16634b2c86b3e1e7c745870f90771d0 Mon Sep 17 00:00:00 2001
|
2019-06-14 14:50:01 +02:00
|
|
|
From: Mihai Dinca <mdinca@suse.de>
|
|
|
|
Date: Thu, 13 Jun 2019 17:48:55 +0200
|
|
|
|
Subject: [PATCH] Fix zypper pkg.list_pkgs expectation and dpkg mocking
|
|
|
|
|
|
|
|
---
|
2021-01-08 13:41:50 +01:00
|
|
|
tests/unit/modules/test_dpkg_lowpkg.py | 22 ++++++++++++++++------
|
|
|
|
1 file changed, 16 insertions(+), 6 deletions(-)
|
2019-06-14 14:50:01 +02:00
|
|
|
|
|
|
|
diff --git a/tests/unit/modules/test_dpkg_lowpkg.py b/tests/unit/modules/test_dpkg_lowpkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
index 160bbcd5b1..dadbc30dfa 100644
|
2019-06-14 14:50:01 +02:00
|
|
|
--- a/tests/unit/modules/test_dpkg_lowpkg.py
|
|
|
|
+++ b/tests/unit/modules/test_dpkg_lowpkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -308,9 +308,14 @@ class DpkgTestCase(TestCase, LoaderModuleMockMixin):
|
|
|
|
dpkg.bin_pkg_info("package.deb")["name"], "package_name"
|
|
|
|
)
|
2019-06-14 14:50:01 +02:00
|
|
|
|
2021-01-08 13:41:50 +01:00
|
|
|
- @patch("salt.modules.dpkg._get_pkg_ds_avail", MagicMock(return_value=dselect_pkg))
|
|
|
|
- @patch("salt.modules.dpkg._get_pkg_info", MagicMock(return_value=pkgs_info))
|
|
|
|
- @patch("salt.modules.dpkg._get_pkg_license", MagicMock(return_value="BSD v3"))
|
|
|
|
+ @patch(
|
|
|
|
+ "salt.modules.dpkg_lowpkg._get_pkg_ds_avail",
|
|
|
|
+ MagicMock(return_value=dselect_pkg),
|
|
|
|
+ )
|
|
|
|
+ @patch("salt.modules.dpkg_lowpkg._get_pkg_info", MagicMock(return_value=pkgs_info))
|
|
|
|
+ @patch(
|
|
|
|
+ "salt.modules.dpkg_lowpkg._get_pkg_license", MagicMock(return_value="BSD v3")
|
|
|
|
+ )
|
2019-06-14 14:50:01 +02:00
|
|
|
def test_info(self):
|
2021-01-08 13:41:50 +01:00
|
|
|
"""
|
2019-06-14 14:50:01 +02:00
|
|
|
Test info
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -359,9 +364,14 @@ class DpkgTestCase(TestCase, LoaderModuleMockMixin):
|
|
|
|
)
|
|
|
|
assert pkg_data["license"] == "BSD v3"
|
2019-06-14 14:50:01 +02:00
|
|
|
|
2021-01-08 13:41:50 +01:00
|
|
|
- @patch("salt.modules.dpkg._get_pkg_ds_avail", MagicMock(return_value=dselect_pkg))
|
|
|
|
- @patch("salt.modules.dpkg._get_pkg_info", MagicMock(return_value=pkgs_info))
|
|
|
|
- @patch("salt.modules.dpkg._get_pkg_license", MagicMock(return_value="BSD v3"))
|
|
|
|
+ @patch(
|
|
|
|
+ "salt.modules.dpkg_lowpkg._get_pkg_ds_avail",
|
|
|
|
+ MagicMock(return_value=dselect_pkg),
|
|
|
|
+ )
|
|
|
|
+ @patch("salt.modules.dpkg_lowpkg._get_pkg_info", MagicMock(return_value=pkgs_info))
|
|
|
|
+ @patch(
|
|
|
|
+ "salt.modules.dpkg_lowpkg._get_pkg_license", MagicMock(return_value="BSD v3")
|
|
|
|
+ )
|
2019-06-14 14:50:01 +02:00
|
|
|
def test_info_attr(self):
|
2021-01-08 13:41:50 +01:00
|
|
|
"""
|
2019-06-14 14:50:01 +02:00
|
|
|
Test info with 'attr' parameter
|
|
|
|
--
|
2021-01-08 13:41:50 +01:00
|
|
|
2.29.2
|
2019-06-14 14:50:01 +02:00
|
|
|
|
|
|
|
|