コード例 #1
0
 def test_can_write_write_everyone_user_read(self):
     """Test when the everyone sid has w rights"""
     groups = [
         (USER_SID, FILE_GENERIC_READ),
         (EVERYONE_SID, FILE_GENERIC_WRITE),
     ]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(can_write(self.testfile))
コード例 #2
0
 def test_can_write_full_everyone(self):
     """test when everyone has full control."""
     groups = [(EVERYONE_SID, FILE_ALL_ACCESS)]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(can_write(self.testfile))
コード例 #3
0
 def test_can_write_full_user(self):
     """Test when the sid has full control."""
     groups = [(USER_SID, FILE_ALL_ACCESS)]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(can_write(self.testfile))
コード例 #4
0
 def test_can_write_read_write_everyone(self):
     """Test when the everyone sid has rw rights."""
     groups = [(EVERYONE_SID, FILE_GENERIC_READ | FILE_GENERIC_WRITE)]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(can_write(self.testfile))
コード例 #5
0
 def test_can_write_read_write_user(self):
     """Test when the user sid has rw rights."""
     # set the file to be read and write just by the user
     groups = [(USER_SID, FILE_GENERIC_READ | FILE_GENERIC_WRITE)]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(can_write(self.testfile))
コード例 #6
0
 def test_canwrite_no_rights(self):
     """Test when the sid is not present."""
     # remove all the rights from the test file so that
     # we cannot read or write
     set_no_rights(self.testfile)
     self.assertFalse(can_write(self.testfile))