From a8f0a15e4067ec278c8a2d690e3bf815523286ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= Date: Thu, 12 Mar 2020 13:26:51 +0000 Subject: [PATCH] Fix wrong test_mod_del_repo_multiline_values test after rebase --- tests/integration/modules/test_pkg.py | 56 +++------------------------ 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/tests/integration/modules/test_pkg.py b/tests/integration/modules/test_pkg.py index 6f3767bfbd272848277b877d1fe640caf8f349f6..0f4c5c9d459c56bb485408f943c1dee49c46cd21 100644 --- a/tests/integration/modules/test_pkg.py +++ b/tests/integration/modules/test_pkg.py @@ -134,6 +134,10 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin): if repo is not None: self.run_function('pkg.del_repo', [repo]) + @destructiveTest + @requires_salt_modules('pkg.mod_repo', 'pkg.del_repo', 'pkg.get_repo') + @requires_network() + @requires_system_grains def test_mod_del_repo_multiline_values(self): ''' test modifying and deleting a software repository defined with multiline values @@ -141,8 +145,9 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin): os_grain = self.run_function('grains.item', ['os'])['os'] repo = None try: - if os_grain in ['CentOS', 'RedHat']: + if os_grain in ['CentOS', 'RedHat', 'SUSE']: my_baseurl = 'http://my.fake.repo/foo/bar/\n http://my.fake.repo.alt/foo/bar/' + expected_get_repo_baseurl_zypp = 'http://my.fake.repo/foo/bar/%0A%20http://my.fake.repo.alt/foo/bar/' expected_get_repo_baseurl = 'http://my.fake.repo/foo/bar/\nhttp://my.fake.repo.alt/foo/bar/' major_release = int( self.run_function( @@ -189,55 +194,6 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin): if repo is not None: self.run_function('pkg.del_repo', [repo]) - def test_mod_del_repo_multiline_values(self): - ''' - test modifying and deleting a software repository defined with multiline values - ''' - os_grain = self.run_function('grains.item', ['os'])['os'] - repo = None - try: - if os_grain in ['CentOS', 'RedHat', 'SUSE']: - my_baseurl = 'http://my.fake.repo/foo/bar/\n http://my.fake.repo.alt/foo/bar/' - expected_get_repo_baseurl_zypp = 'http://my.fake.repo/foo/bar/%0A%20http://my.fake.repo.alt/foo/bar/' - expected_get_repo_baseurl = 'http://my.fake.repo/foo/bar/\nhttp://my.fake.repo.alt/foo/bar/' - major_release = int( - self.run_function( - 'grains.item', - ['osmajorrelease'] - )['osmajorrelease'] - ) - repo = 'fakerepo' - name = 'Fake repo for RHEL/CentOS/SUSE' - baseurl = my_baseurl - gpgkey = 'https://my.fake.repo/foo/bar/MY-GPG-KEY.pub' - failovermethod = 'priority' - gpgcheck = 1 - enabled = 1 - ret = self.run_function( - 'pkg.mod_repo', - [repo], - name=name, - baseurl=baseurl, - gpgkey=gpgkey, - gpgcheck=gpgcheck, - enabled=enabled, - failovermethod=failovermethod, - ) - # return data from pkg.mod_repo contains the file modified at - # the top level, so use next(iter(ret)) to get that key - self.assertNotEqual(ret, {}) - repo_info = ret[next(iter(ret))] - self.assertIn(repo, repo_info) - self.assertEqual(repo_info[repo]['baseurl'], my_baseurl) - ret = self.run_function('pkg.get_repo', [repo]) - self.assertEqual(ret['baseurl'], expected_get_repo_baseurl) - self.run_function('pkg.mod_repo', [repo]) - ret = self.run_function('pkg.get_repo', [repo]) - self.assertEqual(ret['baseurl'], expected_get_repo_baseurl) - finally: - if repo is not None: - self.run_function('pkg.del_repo', [repo]) - @requires_salt_modules('pkg.owner') def test_owner(self): ''' -- 2.23.0