smbd/nmbd: Remove HAVE_LONGLONG
[Samba.git] / python / samba / tests / common.py
blob8794e9dc8b38874b1f8b3ad39c7ba0a4a8f341c4
1 # Unix SMB/CIFS implementation. Tests for common.py routines
2 # Copyright (C) Andrew Tridgell 2011
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.common"""
20 import samba, os
21 import samba.tests
22 from samba.common import *
23 from samba.samdb import SamDB
26 class CommonTests(samba.tests.TestCase):
28 def test_normalise_int32(self):
29 self.assertEquals('17', normalise_int32(17))
30 self.assertEquals('17', normalise_int32('17'))
31 self.assertEquals('-123', normalise_int32('-123'))
32 self.assertEquals('-1294967296', normalise_int32('3000000000'))
34 def test_dsdb_Dn(self):
35 sam = samba.Ldb(url='dntest.ldb')
36 dn1 = dsdb_Dn(sam, "DC=foo,DC=bar")
37 dn2 = dsdb_Dn(sam, "B:8:0000000D:<GUID=b3f0ec29-17f4-452a-b002-963e1909d101>;DC=samba,DC=example,DC=com")
38 self.assertEquals(dn2.binary, "0000000D")
39 self.assertEquals(13, dn2.get_binary_integer())
40 os.unlink('dntest.ldb')