mirror of
https://github.com/samba-team/samba.git
synced 2025-07-30 19:42:05 +03:00
Add tests for new NDR pack/unpack functionality in Python DCE/RPC bindings.
(This used to be commit 468d35827f
)
This commit is contained in:
@ -38,7 +38,7 @@ interface rpcecho
|
|||||||
|
|
||||||
|
|
||||||
/* test some alignment issues */
|
/* test some alignment issues */
|
||||||
typedef struct {
|
typedef [public] struct {
|
||||||
uint8 v;
|
uint8 v;
|
||||||
} echo_info1;
|
} echo_info1;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Unix SMB/CIFS implementation.
|
# Unix SMB/CIFS implementation.
|
||||||
# Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
|
# Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from samba.dcerpc import echo
|
from samba.dcerpc import echo
|
||||||
|
from samba.ndr import ndr_pack, ndr_unpack
|
||||||
import unittest
|
import unittest
|
||||||
from samba.tests import RpcInterfaceTestCase
|
from samba.tests import RpcInterfaceTestCase
|
||||||
|
|
||||||
@ -40,3 +41,14 @@ class RpcEchoTests(RpcInterfaceTestCase):
|
|||||||
surrounding_struct.surrounding = [1,2,3,4]
|
surrounding_struct.surrounding = [1,2,3,4]
|
||||||
y = self.conn.TestSurrounding(surrounding_struct)
|
y = self.conn.TestSurrounding(surrounding_struct)
|
||||||
self.assertEquals(8 * [0], y.surrounding)
|
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)
|
||||||
|
Reference in New Issue
Block a user