1 # Unix SMB/CIFS implementation.
2 # Copyright Volker Lendecke <vl@samba.org> 2012
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.samba3.libsmb_samba_internal."""
20 from samba.samba3 import libsmb_samba_internal
21 from samba.dcerpc import security
22 from samba.samba3 import param as s3param
23 from samba import credentials
29 class LibsmbTestCase(samba.tests.TestCase):
31 class OpenClose(threading.Thread):
33 def __init__(self, conn, filename, num_ops):
34 threading.Thread.__init__(self)
36 self.filename = filename
37 self.num_ops = num_ops
43 for i in range(self.num_ops):
44 f = c.create(self.filename, CreateDisposition=3,
45 DesiredAccess=security.SEC_STD_DELETE)
46 c.delete_on_close(f, True)
49 self.exc = sys.exc_info()
51 def test_OpenClose(self):
53 lp = s3param.get_context()
54 lp.load(os.getenv("SMB_CONF_PATH"))
56 creds = credentials.Credentials()
57 creds.set_username(os.getenv("USERNAME"))
58 creds.set_password(os.getenv("PASSWORD"))
60 c = libsmb_samba_internal.Conn(os.getenv("SERVER_IP"), "tmp", creds)
65 t = LibsmbTestCase.OpenClose(c, "test" + str(i), 10)
74 raise t.exc[0](t.exc[1])
76 if __name__ == "__main__":