summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2008-04-16 00:07:34 -0400
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2008-04-16 00:07:34 -0400
commit708d323a3e4a057891b29950e35f14c62f791c7e (patch)
tree5a25a61eff229c460d2872520a06e5673f93472b /test
parent8cf7662a1f7710dad36b32a686f00a9d3c9dbf10 (diff)
downloadthird_party-func-708d323a3e4a057891b29950e35f14c62f791c7e.tar.gz
third_party-func-708d323a3e4a057891b29950e35f14c62f791c7e.tar.xz
third_party-func-708d323a3e4a057891b29950e35f14c62f791c7e.zip
add a "echo" to the test module
write some unit tests that use the "test.echo" module to test some basic marshall/demarshalling code
Diffstat (limited to 'test')
-rw-r--r--test/unittest/test_client.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/unittest/test_client.py b/test/unittest/test_client.py
index acf242c..578dd90 100644
--- a/test/unittest/test_client.py
+++ b/test/unittest/test_client.py
@@ -83,6 +83,51 @@ class TestTest(BaseTest):
self.assert_on_fault(result)
assert result[self.th] == "foobar"
+ def test_sleep(self):
+ result = self.overlord.test.sleep(1)
+ self.assert_on_fault(result)
+
+ def _echo_test(self, data):
+ result = self.overlord.test.echo(data)
+ self.assert_on_fault(result)
+ assert result[self.th] == data
+
+ # this tests are basically just to test the basic
+ # marshalling/demarshaling bits
+ def test_echo_int(self):
+ self._echo_test(1)
+
+ def test_echo_string(self):
+ self._echo_test("caneatcheese")
+
+ def test_echo_array(self):
+ self._echo_test([1, 2, "three", "fore", "V",])
+
+ def test_echo_hash(self):
+ self._echo_test({"one":1, "too":2, "III":3, "many":8, "lots":12312})
+
+ def test_echo_bool_false(self):
+ self._echo_test(False)
+
+ def test_echo_bool_true(self):
+ self._echo_test(True)
+
+ def test_echo_float(self):
+ self._echo_test(123.456)
+
+ def test_echo_binary(self):
+ blob = "348dshke354ts0d9urgk"
+ import xmlrpclib
+ data = xmlrpclib.Binary(blob)
+ self._echo_test(data)
+
+ def test_echo_date(self):
+ import datetime
+ dt = datetime.datetime(1974, 1, 5, 11, 59 ,0,0, None)
+ import xmlrpclib
+ data = xmlrpclib.DateTime(dt)
+ self._echo_test(data)
+
class TestCommand(BaseTest):