summaryrefslogtreecommitdiffstats
path: root/src/software
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-12-15 12:05:17 +0100
committerMichal Minar <miminar@redhat.com>2013-12-19 09:52:28 +0100
commitc2e4fbf0b9b118c4c3c7daccf87b5d67bfe1a95a (patch)
tree8526d51fc3f2f4782b22d429ed62974d55a322f5 /src/software
parent5ebbb6388e08b0bc123779dbfa3bae3094365659 (diff)
downloadopenlmi-providers-c2e4fbf0b9b118c4c3c7daccf87b5d67bfe1a95a.tar.gz
openlmi-providers-c2e4fbf0b9b118c4c3c7daccf87b5d67bfe1a95a.tar.xz
openlmi-providers-c2e4fbf0b9b118c4c3c7daccf87b5d67bfe1a95a.zip
software: added test for SoftwareInstallationService
It checks, that error description is retrievable when the asynchronous job fails to execute.
Diffstat (limited to 'src/software')
-rw-r--r--src/software/test/test_software_installation_service.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/software/test/test_software_installation_service.py b/src/software/test/test_software_installation_service.py
index eb38f0c..1b95c21 100644
--- a/src/software/test/test_software_installation_service.py
+++ b/src/software/test/test_software_installation_service.py
@@ -57,6 +57,7 @@ TRANSITIONING_TO_STATE_NOT_APPLICABLE = 12
JOB_COMPLETED_WITH_NO_ERROR = 0
UNSPECIFIED_ERROR = 2
+INVALID_PARAMETER = 5
METHOD_PARAMETERS_CHECKED_JOB_STARTED = 4096
class TestSoftwareInstallationService(swbase.SwTestCase):
@@ -382,6 +383,25 @@ class TestSoftwareInstallationService(swbase.SwTestCase):
up_pkg = self.get_repo('updates')['pkg1']
self.assertTrue(package.is_pkg_installed(up_pkg))
+ @swbase.test_with_repos('stable', 'updates')
+ @swbase.test_with_packages(**{'pkg1' : False})
+ def test_update_not_installed_package_sync(self):
+ """
+ Try to synchronously update package which is not installed.
+ """
+ pkg = self.get_repo('stable')['pkg1']
+ self.assertFalse(package.is_pkg_installed(pkg.name))
+ service = self.make_op().to_instance()
+ rval, oparms, error = service.SyncInstallFromSoftwareIdentity(
+ Source=util.make_pkg_op(self.ns, pkg),
+ InstallOptions=[INSTALL_OPTIONS_UPDATE],
+ Target=self.system_iname)
+ self.assertEqual(rval, INVALID_PARAMETER)
+ self.assertGreater(len(error), 0)
+ self.assertTrue( len(oparms) == 0
+ or ('Job' in oparms and oparms['Job'] is None))
+ self.assertFalse(package.is_pkg_installed(pkg.name))
+
@enable_lmi_exceptions
@swbase.test_with_repos('stable')
@swbase.test_with_packages(**{ 'pkg1' : False })