summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-24 19:50:09 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-24 19:50:09 +0200
commit05194ccdf875ee70cb9ee3f7c27147503d585a6d (patch)
treed927cadf03a4904e141b85b67304468bbca93335 /source4/scripting
parente3bbe61d8162ebb5bf4ef2d3702587b39b0c4284 (diff)
downloadsamba-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)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/ndr.py1
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/rpcecho.py12
2 files changed, 13 insertions, 0 deletions
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)