summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2008-01-17 17:21:25 -0500
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2008-01-17 17:21:25 -0500
commitf9a7425dd6ba8f360141922e2c18badb7979d0ea (patch)
tree093a8cd35a9c174f3300c609bbc72189c9b98d41 /test
parent8d8ab7730a506d117cb61796df9d40aa1bc6cea9 (diff)
downloadthird_party-func-f9a7425dd6ba8f360141922e2c18badb7979d0ea.tar.gz
third_party-func-f9a7425dd6ba8f360141922e2c18badb7979d0ea.tar.xz
third_party-func-f9a7425dd6ba8f360141922e2c18badb7979d0ea.zip
add methods to BaseTest to also test the introspection methods
test modules need to set a "module" attr with the module name now.
Diffstat (limited to 'test')
-rw-r--r--test/unittest/test_client.py73
1 files changed, 72 insertions, 1 deletions
diff --git a/test/unittest/test_client.py b/test/unittest/test_client.py
index 1670341..9ba4d05 100644
--- a/test/unittest/test_client.py
+++ b/test/unittest/test_client.py
@@ -16,9 +16,23 @@ class BaseTest:
def setUp(self):
self.client = fc.Client(self.th)
-
+ def test_module_version(self):
+ mod = getattr(self.client, self.module)
+ result = mod.module_version()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+ def test_module_api_version(self):
+ mod = getattr(self.client, self.module)
+ result = mod.module_api_version()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+ def test_module_description(self):
+ mod = getattr(self.client, self.module)
+ result = mod.module_description()
+ assert type(result[self.th]) != xmlrpclib.Fault
class TestTest(BaseTest):
+ module = "test"
def test_add(self):
result = self.client.test.add(1,5)
@@ -34,6 +48,7 @@ class TestTest(BaseTest):
class TestCommand(BaseTest):
+ module = "command"
def test_echo(self):
result = self.client.command.run("echo -n foo")
@@ -50,6 +65,7 @@ class TestCopyfile(BaseTest):
fn = "/tmp/func_test_file"
dest_fn = "/tmp/func_test_file_dest"
content = "this is a func test file"
+ module = "copyfile"
def create_a_file(self):
f = open(self.fn, "w")
f.write(self.content)
@@ -72,6 +88,7 @@ class TestCopyfile(BaseTest):
class TestHardware(BaseTest):
+ module = "hardware"
def test_inventory(self):
result = self.client.hardware.inventory()
assert type(result[self.th]) != xmlrpclib.Fault
@@ -90,6 +107,7 @@ class TestHardware(BaseTest):
class TestFileTracker(BaseTest):
fn = "/etc/hosts"
+ module = "filetracker"
def test_track(self):
result = self.client.filetracker.track(self.fn)
assert result[self.th] == 1
@@ -113,6 +131,7 @@ class TestFileTracker(BaseTest):
class TestMount(BaseTest):
+ module = "mount"
def test_mount_list(self):
result = self.client.mount.list()
#FIXME: I probably should make the test for xmlrpclib faults a bit
@@ -123,6 +142,7 @@ class TestMount(BaseTest):
class TestNetworkTest(BaseTest):
+ module = "networktest"
def test_ping(self):
result = self.client.networktest.ping(self.th, "-c", "2")
assert type(result[self.th]) != xmlrpclib.Fault
@@ -154,6 +174,7 @@ class TestNetworkTest(BaseTest):
class TestProcess(BaseTest):
+ module = "process"
def test_info(self):
result = self.client.process.info()
assert type(result[self.th]) != xmlrpclib.Fault
@@ -167,6 +188,7 @@ class TestProcess(BaseTest):
class TestService(BaseTest):
+ module = "service"
def test_inventory(self):
result = self.client.service.inventory()
assert type(result[self.th]) != xmlrpclib.Fault
@@ -187,3 +209,52 @@ class TestService(BaseTest):
#FIXME: whats a good way to test starting/stoping services without
# doing bad things? -akl
+
+class TestRpm(BaseTest):
+ module = "rpms"
+ def test_inventory(self):
+ result = self.client.rpms.inventory()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+
+class TestSmart(BaseTest):
+ module = "smart"
+ def test_info(self):
+ result = self.client.smart.info()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+
+class TestYum(BaseTest):
+ module = "yumcmd"
+ def test_check_update(self):
+ result = self.client.yumcmd.check_update()
+ assert type(result[self.th]) != xmlrpclib.Fault
+ print result
+
+class TestSystem(BaseTest):
+ module = "system"
+ def test_list_methods(self):
+ result = self.client.system.list_methods()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+
+ def test_listMethods(self):
+ result = self.client.system.listMethods()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+ def test_list_modules(self):
+ result = self.client.system.list_modules()
+ assert type(result[self.th]) != xmlrpclib.Fault
+
+
+ #FIXME: we really should just implement these for the system stuff
+ # as well
+ def test_module_version(self):
+ pass
+
+ def test_module_api_version(self):
+ pass
+
+ def test_module_description(self):
+ pass
+