Change in vdsm[master]: test CommandPath
danken at redhat.com
danken at redhat.com
Thu Jan 17 20:15:24 UTC 2013
Dan Kenigsberg has uploaded a new change for review.
Change subject: test CommandPath
......................................................................
test CommandPath
Change-Id: I0b53d5ce56551fea8c6ecf7801ca2de86334cf49
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/utilsTests.py
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/11165/1
diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index cb32c65..dcc78ed 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -1,5 +1,5 @@
#
-# Copyright 2012 Red Hat, Inc.
+# Copyright 2012-2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
#
# Refer to the README and COPYING files for full details of the license
#
+import errno
+
from testrunner import VdsmTestCase as TestCaseBase
from vdsm import utils
from storage import misc
@@ -58,3 +60,18 @@
self.assertEquals(name, args[0])
sproc.kill()
sproc.wait()
+
+
+class CommandPathTests(TestCaseBase):
+ def testExisting(self):
+ cp = utils.CommandPath('sh', 'utter nonsense', '/bin/sh')
+ self.assertEquals(cp.cmd, '/bin/sh')
+
+ def testMissing(self):
+ NAME = 'nonsense'
+ try:
+ utils.CommandPath(NAME, 'utter nonsense').cmd
+ except OSError as e:
+ self.assertEquals(e.errno, errno.ENOENT)
+ self.assertTrue(NAME in e.strerror,
+ msg='%s not in %s' % (NAME, e.strerror))
--
To view, visit http://gerrit.ovirt.org/11165
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b53d5ce56551fea8c6ecf7801ca2de86334cf49
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
More information about the vdsm-patches
mailing list