From fd3b31e16fa70ac052b27c80cd91ab2ebeb80f60 Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Wed, 18 Dec 2013 14:10:39 +0100 Subject: software: test fixes * Restore repository, after the test run, only if it was previously enabled. * yum-config-manager, which is used to get information about reporitories, shortens lines on its output when too long. Therefor repository name can not be checked for exact match against data in LMI_SoftwareIdentityResource if it is too long. (cherry picked from commit dac1d1ac6de74e30b1e62d90a9b936c087de0b28) --- src/software/test/swbase.py | 3 ++- src/software/test/test_software_identity_resource.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/software/test/swbase.py b/src/software/test/swbase.py index 8ef4b3b..c06158b 100644 --- a/src/software/test/swbase.py +++ b/src/software/test/swbase.py @@ -251,7 +251,8 @@ class SwTestCase(LmiTestCase): if not getattr(SwTestCase, '_restore_repos', []): SwTestCase._restore_repos = [] for repoid in repository.get_repo_list('enabled'): - if repoid in SwTestCase.other_repos: + if repoid in SwTestCase.other_repos \ + and repository.is_repo_enabled(repoid): SwTestCase._restore_repos.append(repoid) repository.set_repos_enabled(SwTestCase._restore_repos, False) for repoid in SwTestCase._restore_repos: diff --git a/src/software/test/test_software_identity_resource.py b/src/software/test/test_software_identity_resource.py index be48200..a53b361 100644 --- a/src/software/test/test_software_identity_resource.py +++ b/src/software/test/test_software_identity_resource.py @@ -107,7 +107,13 @@ class TestSoftwareIdentityResource(swbase.SwTestCase): "AccessInfo missing in base_urls for repo %s" % repo.repoid) self.assertIsInstance(inst.AvailableRequestedStates, list) - self.assertEqual(inst.Caption, repo.name) + # Unfortunately, yum-config-manager shortens lines on its output + # therefor we can not check very long names. + # 61 characters in version yum-utils-1.1.31-19.fc21 + if len(repo.name) > 60: + self.assertTrue(inst.Caption.startswith(repo.name)) + else: + self.assertEqual(inst.Caption, repo.name) self.assertIsInstance(inst.Cost, pywbem.Sint32) self.assertIsInstance(inst.Description, basestring) self.assertEqual(inst.ElementName, repo.repoid) -- cgit