summaryrefslogtreecommitdiffstats
path: root/src/software
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-12-18 14:10:39 +0100
committerMichal Minar <miminar@redhat.com>2013-12-19 09:52:28 +0100
commitdac1d1ac6de74e30b1e62d90a9b936c087de0b28 (patch)
treea02d5ac5d4bbaa63ec8df42065c5bf959e634c61 /src/software
parentc2e4fbf0b9b118c4c3c7daccf87b5d67bfe1a95a (diff)
downloadopenlmi-providers-dac1d1ac6de74e30b1e62d90a9b936c087de0b28.tar.gz
openlmi-providers-dac1d1ac6de74e30b1e62d90a9b936c087de0b28.tar.xz
openlmi-providers-dac1d1ac6de74e30b1e62d90a9b936c087de0b28.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.
Diffstat (limited to 'src/software')
-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)