summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-04-25 10:13:05 +0200
committerJan Synacek <jsynacek@redhat.com>2014-04-28 08:52:12 +0200
commit5ec8c61604697948673fe5c92cd45a036c10ff18 (patch)
tree580f4db90ded36f342722f5e96c8c48547a900bd /src
parent4354a7f31b6ed6a0b8cf58d2bd3cc10945385a4f (diff)
downloadopenlmi-providers-5ec8c61604697948673fe5c92cd45a036c10ff18.tar.gz
openlmi-providers-5ec8c61604697948673fe5c92cd45a036c10ff18.tar.xz
openlmi-providers-5ec8c61604697948673fe5c92cd45a036c10ff18.zip
logicalfile: enhance tests
After creating a directory or symlink, check if the object created really is the directory or symlink.
Diffstat (limited to 'src')
-rw-r--r--src/logicalfile/test/test_basic.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/logicalfile/test/test_basic.py b/src/logicalfile/test/test_basic.py
index b5871fb..cf31981 100644
--- a/src/logicalfile/test/test_basic.py
+++ b/src/logicalfile/test/test_basic.py
@@ -429,14 +429,21 @@ class TestLogicalFile(LogicalFileTestBase):
self.assertEquals(rootdir['Name'], '/')
def test_mkdir(self):
+ classname = 'LMI_UnixDirectory'
+ cop = self.cop.copy()
+ path = self.testdir + '/mkdir-test'
+
def mkdir(path):
- cop = self.cop.copy()
cop['Name'] = path
- inst = pywbem.CIMInstance('LMI_UnixDirectory', cop.keybindings)
+ inst = pywbem.CIMInstance(classname, cop.keybindings)
self.wbemconnection.CreateInstance(inst)
try:
- mkdir(self.testdir + '/mkdir-test')
+ mkdir(path)
+ inst = self.wbemconnection.GetInstance(cop)
+ self.assertEquals(inst.classname, classname)
+ self.assertEquals(inst['CreationClassName'], classname)
+ self.assertEquals(inst['Name'], path)
except pywbem.CIMError as pe:
self.fail(pe[1])
@@ -444,6 +451,7 @@ class TestLogicalFile(LogicalFileTestBase):
mkdir,
'/cant/create/me')
+
def test_rmdir(self):
def rmdir(path):
cop = self.cop.copy()
@@ -461,18 +469,25 @@ class TestLogicalFile(LogicalFileTestBase):
'/cant/remove/me')
def test_create_symlink(self):
+ classname = 'LMI_SymbolicLink'
+ cop = self.cop.copy()
+ cop.classname = classname
+ target = self.files['data']['path']
+ name = self.testdir + '/target-symlink'
+
def create_symlink(target, path):
- cop = self.cop.copy()
cop['Name'] = path
- cop['TargetFile'] = path
- inst = pywbem.CIMInstance('LMI_SymbolicLink', cop.keybindings)
+ cop['TargetFile'] = target
+ inst = pywbem.CIMInstance(classname, cop.keybindings)
self.wbemconnection.CreateInstance(inst)
- target = self.files['data']['path']
- name = self.testdir + '/target-symlink'
-
try:
create_symlink(target, name)
+ inst = self.wbemconnection.GetInstance(cop)
+ self.assertEquals(inst.classname, classname)
+ self.assertEquals(inst['CreationClassName'], classname)
+ self.assertEquals(inst['TargetFile'], target)
+ self.assertEquals(inst['Name'], name)
except pywbem.CIMError as pe:
self.fail(pe[1])