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))
 def test_access_read_user_everyone(self):
     """Test when user and everyone have r rights."""
     groups = [
         (USER_SID, FILE_GENERIC_READ),
         (EVERYONE_SID, FILE_GENERIC_READ),
     ]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(access(self.testfile))
 def test_access_write_user_everyone(self):
     """Test when everyone and user have w rights."""
     groups = [
         (USER_SID, FILE_GENERIC_WRITE),
         (EVERYONE_SID, FILE_GENERIC_WRITE),
     ]
     _set_file_attributes(self.valid_path, groups)
     self.assertFalse(access(self.testfile))
 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))
 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))
 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))
 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))
 def test_access_read_user(self):
     """Test when the sid has r rights."""
     groups = [(USER_SID, FILE_GENERIC_READ)]
     _set_file_attributes(self.valid_path, groups)
     self.assertTrue(access(self.testfile))