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
24 class UnixinfoTests(RpcInterfaceTestCase
):
27 super(UnixinfoTests
, self
).setUp()
28 self
.conn
= unixinfo
.unixinfo("ncalrpc:", self
.get_loadparm())
30 def test_getpwuid_int(self
):
31 infos
= self
.conn
.GetPWUid(range(512))
32 self
.assertEquals(512, len(infos
))
33 self
.assertEquals("/bin/false", infos
[0].shell
)
34 self
.assertTrue(isinstance(infos
[0].homedir
, unicode))
36 def test_getpwuid(self
):
37 infos
= self
.conn
.GetPWUid(map(long, range(512)))
38 self
.assertEquals(512, len(infos
))
39 self
.assertEquals("/bin/false", infos
[0].shell
)
40 self
.assertTrue(isinstance(infos
[0].homedir
, unicode))
42 def test_gidtosid(self
):
43 self
.conn
.GidToSid(1000L)
45 def test_uidtosid(self
):
46 self
.conn
.UidToSid(1000)
48 def test_uidtosid_fail(self
):
49 self
.assertRaises(TypeError, self
.conn
.UidToSid
, "100")