python:samba:tests: Fix code spelling
[samba.git] / python / samba / tests / smb1posix.py
1 # Unix SMB/CIFS implementation.
2 # Copyright Volker Lendecke <vl@samba.org> 2022
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 from samba.samba3 import libsmb_samba_internal as libsmb
19 from samba import (ntstatus,NTSTATUSError)
20 from samba.dcerpc import security as sec
21 import samba.tests.libsmb
22 import stat
23
24 class Smb1PosixTests(samba.tests.libsmb.LibsmbTests):
25
26     def test_directory_case_sensivity(self):
27         """Test that in smb1 posix dirs are case sensitive"""
28         conn = libsmb.Conn(
29             self.server_ip,
30             "posix_share",
31             self.lp,
32             self.creds,
33             force_smb1=True)
34         conn.smb1_posix()
35
36         try:
37             conn.mkdir("lower")
38         except NTSTATUSError as e:
39             if e.args[0] != ntstatus.NT_STATUS_OBJECT_NAME_COLLISION:
40                 raise
41         try:
42             conn.mkdir("lower/second")
43         except NTSTATUSError as e:
44             if e.args[0] != ntstatus.NT_STATUS_OBJECT_NAME_COLLISION:
45                 raise
46
47         self.assertFalse(conn.chkpath("Lower/second"))
48         conn.rmdir("lower/second")
49         conn.rmdir("lower")
50
51     def test_mknod(self):
52         """Test SMB1 posix mknod"""
53         conn = libsmb.Conn(
54             self.server_ip,
55             "posix_share",
56             self.lp,
57             self.creds,
58             force_smb1=True)
59         conn.smb1_posix()
60
61         def do_test(name, filetype):
62             conn.mknod(name, filetype | 0o755)
63             st = conn.smb1_stat(name)
64             self.assertEqual(st["mode"], filetype | 0o755)
65             conn.unlink(name)
66
67         do_test("fifo", stat.S_IFIFO)
68         do_test("sock", stat.S_IFSOCK)
69
70 if __name__ == '__main__':
71     import unittest
72     unittest.main()