Fix use of TestCase.skipTest on python2.6 now that we no longer use testtools.
[Samba.git] / python / samba / tests / dcerpc / srvsvc.py
blob407a9d52a7356f017b14cb4ec9b641b4049ab63b
1 # -*- coding: utf-8 -*-
3 # Unix SMB/CIFS implementation.
4 # Copyright © Dhananjay Sathe <dhanajaysathe@gmail.com> 2011
5 # Copyright © Jelmer Vernooij <jelmer@samba.org> 2011
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 """Tests for samba.dcerpc.srvsvc."""
23 from samba.dcerpc import srvsvc
24 from samba.tests import RpcInterfaceTestCase
27 class SrvsvcTests(RpcInterfaceTestCase):
29 def setUp(self):
30 super(SrvsvcTests, self).setUp()
31 self.conn = srvsvc.srvsvc("ncalrpc:", self.get_loadparm())
32 self.server_unc = "\\\\."
34 def getDummyShareObject(self):
35 share = srvsvc.NetShareInfo2()
37 share.name = u'test'
38 share.comment = u'test share'
39 share.type = srvsvc.STYPE_DISKTREE
40 share.current_users = 0x00000000
41 share.max_users = -1
42 share.password = None
43 share.path = u'C:\\tmp' # some random path
44 share.permissions = 123434566
45 return share
47 def test_NetShareAdd(self):
48 self.skipTest("Dangerous test")
49 share = self.getDummyShareObject()
50 self.conn.NetShareAdd(self.server_unc, 2, share, None)
52 def test_NetShareSetInfo(self):
53 self.skipTest("Dangerous test")
54 share = self.getDummyShareObject()
55 parm_error = 0x00000000
56 self.conn.NetShareAdd(self.server_unc, 502, share, parm_error)
57 name = share.name
58 share.comment = "now sucessfully modified "
59 parm_error = self.pipe.NetShareSetInfo(self.server_unc, name,
60 502, share, parm_error)
62 def test_NetShareDel(self):
63 self.skipTest("Dangerous test")
64 share = self.getDummyShareObject()
65 parm_error = 0x00000000
66 self.expectFailure("NetShareAdd doesn't work properly from Python",
67 self.conn.NetShareAdd, self.server_unc, 502, share, parm_error)
68 self.conn.NetShareDel(self.server_unc, share.name, 0)