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
22 from unittest
import TestCase
23 from samba
.tests
import cmdline_loadparm
26 class BareTestCase(TestCase
):
28 # Connect to the echo pipe
29 x
= ClientConnection("ncalrpc:localhost[DEFAULT]",
30 ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx
=cmdline_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), lp_ctx
=cmdline_loadparm
)
36 y
= ClientConnection("ncalrpc:localhost",
37 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
38 basis_connection
=x
, lp_ctx
=cmdline_loadparm
)
39 x
.alter_context(("60a15ec5-4de8-11d7-a637-005056a20182", 1))
40 # FIXME: self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4))
42 def test_two_connections(self
):
43 x
= ClientConnection("ncalrpc:localhost[DEFAULT]",
44 ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx
=cmdline_loadparm
)
45 y
= ClientConnection("ncalrpc:localhost",
46 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
47 basis_connection
=x
, lp_ctx
=cmdline_loadparm
)
48 self
.assertEquals("\x01\x00\x00\x00", y
.request(0, chr(0) * 4))