2 # -*- coding: utf-8 -*-
4 # Unix SMB/CIFS implementation.
5 # Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 from samba.dcerpc import ClientConnection
24 class BareTestCase(samba.tests.TestCase):
27 # Connect to the echo pipe
28 x = ClientConnection("ncalrpc:localhost[DEFAULT]",
29 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
30 lp_ctx=samba.tests.env_loadparm())
31 self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4))
33 def test_alter_context(self):
34 x = ClientConnection("ncalrpc:localhost[DEFAULT]",
35 ("12345778-1234-abcd-ef00-0123456789ac", 1),
36 lp_ctx=samba.tests.env_loadparm())
37 y = ClientConnection("ncalrpc:localhost",
38 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
39 basis_connection=x, lp_ctx=samba.tests.env_loadparm())
40 x.alter_context(("60a15ec5-4de8-11d7-a637-005056a20182", 1))
41 # FIXME: self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4))
43 def test_two_connections(self):
44 x = ClientConnection("ncalrpc:localhost[DEFAULT]",
45 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
46 lp_ctx=samba.tests.env_loadparm())
47 y = ClientConnection("ncalrpc:localhost",
48 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
49 basis_connection=x, lp_ctx=samba.tests.env_loadparm())
50 self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4))