summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-12-18 14:10:39 +0100
committerMichal Minar <miminar@redhat.com>2014-01-06 14:58:00 +0100
commitfd3b31e16fa70ac052b27c80cd91ab2ebeb80f60 (patch)
tree95b54a6175fa66b660f2ec2a4299eb559a3aa5d7
parent7c03d60f0508e9694e40b56eddb240efcb8cd524 (diff)
downloadopenlmi-providers-fd3b31e16fa70ac052b27c80cd91ab2ebeb80f60.tar.gz
openlmi-providers-fd3b31e16fa70ac052b27c80cd91ab2ebeb80f60.tar.xz
openlmi-providers-fd3b31e16fa70ac052b27c80cd91ab2ebeb80f60.zip
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)
-rw-r--r--src/software/test/swbase.py3
-rw-r--r--src/software/test/test_software_identity_resource.py8
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)