1 # Unix SMB/CIFS implementation.
2 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
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.
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.
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/>.
18 """Tests for samba.dcerpc.unixinfo."""
21 from samba.dcerpc import unixinfo
22 from samba.tests import RpcInterfaceTestCase
25 class UnixinfoTests(RpcInterfaceTestCase):
28 super(UnixinfoTests, self).setUp()
29 self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm())
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))
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))
43 def test_gidtosid(self):
44 self.conn.GidToSid(1000L)
46 def test_uidtosid(self):
47 self.conn.UidToSid(1000)
49 def test_uidtosid_fail(self):
50 self.assertRaises(TypeError, self.conn.UidToSid, "100")