vfs_ceph_new: common prefix to debug-log messages
[Samba.git] / python / samba / tests / dcerpc / bare.py
blob622965277e7165a4aeeb0261b34a67f49f352e7b
1 # -*- coding: utf-8 -*-
3 # Unix SMB/CIFS implementation.
4 # Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 """Tests for samba.tests.dcerpc.bare."""
22 import os
23 from samba.dcerpc import ClientConnection
24 import samba.tests
27 class BareTestCase(samba.tests.TestCase):
29 def test_bare(self):
30 # Connect to the echo pipe
31 x = ClientConnection("ncalrpc:localhost[DEFAULT]",
32 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
33 lp_ctx=samba.tests.env_loadparm())
34 self.assertEqual(b"\x01\x00\x00\x00", x.request(0, chr(0) * 4))
36 def test_two_contexts(self):
37 x = ClientConnection("ncalrpc:localhost[DEFAULT]",
38 ("12345778-1234-abcd-ef00-0123456789ac", 1),
39 lp_ctx=samba.tests.env_loadparm())
40 y = ClientConnection("ncalrpc:localhost",
41 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
42 basis_connection=x, lp_ctx=samba.tests.env_loadparm())
43 self.assertEqual(24, len(x.request(0, chr(0) * 8)))
44 self.assertEqual(b"\x01\x00\x00\x00", y.request(0, chr(0) * 4))
46 def test_bare_tcp(self):
47 # Connect to the echo pipe
48 x = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
49 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
50 lp_ctx=samba.tests.env_loadparm())
51 self.assertEqual(b"\x01\x00\x00\x00", x.request(0, chr(0) * 4))
53 def test_two_contexts_tcp(self):
54 x = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
55 ("12345778-1234-abcd-ef00-0123456789ac", 1),
56 lp_ctx=samba.tests.env_loadparm())
57 y = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
58 ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
59 basis_connection=x, lp_ctx=samba.tests.env_loadparm())
60 self.assertEqual(24, len(x.request(0, chr(0) * 8)))
61 self.assertEqual(b"\x01\x00\x00\x00", y.request(0, chr(0) * 4))