diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-05-24 19:50:09 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-05-24 19:50:09 +0200 |
commit | 05194ccdf875ee70cb9ee3f7c27147503d585a6d (patch) | |
tree | d927cadf03a4904e141b85b67304468bbca93335 | |
parent | e3bbe61d8162ebb5bf4ef2d3702587b39b0c4284 (diff) | |
download | samba-05194ccdf875ee70cb9ee3f7c27147503d585a6d.tar.gz samba-05194ccdf875ee70cb9ee3f7c27147503d585a6d.tar.bz2 samba-05194ccdf875ee70cb9ee3f7c27147503d585a6d.zip |
Add tests for new NDR pack/unpack functionality in Python DCE/RPC bindings.
(This used to be commit 468d35827fd055c82c6d43d6ce6d3d561abed54d)
-rw-r--r-- | source4/librpc/idl/echo.idl | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/ndr.py | 1 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/dcerpc/rpcecho.py | 12 |
3 files changed, 14 insertions, 1 deletions
diff --git a/source4/librpc/idl/echo.idl b/source4/librpc/idl/echo.idl index 5ea37f1ac1..bf1e318674 100644 --- a/source4/librpc/idl/echo.idl +++ b/source4/librpc/idl/echo.idl @@ -38,7 +38,7 @@ interface rpcecho /* test some alignment issues */ - typedef struct { + typedef [public] struct { uint8 v; } echo_info1; diff --git a/source4/scripting/python/samba/ndr.py b/source4/scripting/python/samba/ndr.py index e93fbc3c2e..e718ff3422 100644 --- a/source4/scripting/python/samba/ndr.py +++ b/source4/scripting/python/samba/ndr.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # Unix SMB/CIFS implementation. # Copyright © Jelmer Vernooij <jelmer@samba.org> 2008 diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py index 3b37f8a9bc..9157f83fc9 100644 --- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py +++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py @@ -18,6 +18,7 @@ # from samba.dcerpc import echo +from samba.ndr import ndr_pack, ndr_unpack import unittest from samba.tests import RpcInterfaceTestCase @@ -40,3 +41,14 @@ class RpcEchoTests(RpcInterfaceTestCase): surrounding_struct.surrounding = [1,2,3,4] y = self.conn.TestSurrounding(surrounding_struct) self.assertEquals(8 * [0], y.surrounding) + + +class NdrEchoTests(unittest.TestCase): + def test_info1_push(self): + x = echo.info1() + x.v = 42 + self.assertEquals("\x2a", ndr_pack(x)) + + def test_info1_pull(self): + x = ndr_unpack(echo.info1, "\x42") + self.assertEquals(x.v, 66) |