From 708d323a3e4a057891b29950e35f14c62f791c7e Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Wed, 16 Apr 2008 00:07:34 -0400 Subject: add a "echo" to the test module write some unit tests that use the "test.echo" module to test some basic marshall/demarshalling code --- test/unittest/test_client.py | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test/unittest') 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): -- cgit