PEP8: fix E302: expected 2 blank lines, found 1
[samba.git] / python / samba / tests / dcerpc / unix.py
1 # Unix SMB/CIFS implementation.
2 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17
18 """Tests for samba.dcerpc.unixinfo."""
19
20
21 from samba.dcerpc import unixinfo
22 from samba.tests import RpcInterfaceTestCase
23
24
25 class UnixinfoTests(RpcInterfaceTestCase):
26
27     def setUp(self):
28         super(UnixinfoTests, self).setUp()
29         self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm())
30
31     def test_getpwuid_int(self):
32         infos = self.conn.GetPWUid(range(512))
33         self.assertEquals(512, len(infos))
34         self.assertEquals("/bin/false", infos[0].shell)
35         self.assertTrue(isinstance(infos[0].homedir, unicode))
36
37     def test_getpwuid(self):
38         infos = self.conn.GetPWUid(map(long, range(512)))
39         self.assertEquals(512, len(infos))
40         self.assertEquals("/bin/false", infos[0].shell)
41         self.assertTrue(isinstance(infos[0].homedir, unicode))
42
43     def test_gidtosid(self):
44         self.conn.GidToSid(1000L)
45
46     def test_uidtosid(self):
47         self.conn.UidToSid(1000)
48
49     def test_uidtosid_fail(self):
50         self.assertRaises(TypeError, self.conn.UidToSid, "100")