Add unit tests for privilege excution in KIO
ClosedPublic

Authored by chinmoyr on Aug 20 2017, 9:17 AM.

Details

Summary

Auto testing privilege operation is not feasible because it requires user interaction. So instead what we do
is check if the flag for privilege execution is set and if the sub-jobs have a parent job.
If the conditions are met then metadata "TestData" is added which tells that the job is properly configured
and can perform file operations with elevated privileges.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chinmoyr created this revision.Aug 20 2017, 9:17 AM
ltoscano set the repository for this revision to R241 KIO.Aug 20 2017, 5:48 PM
sitter added a subscriber: Frameworks.
dfaure requested changes to this revision.Sep 3 2017, 8:06 AM

Looks good, just some minor things.

autotests/privilegejobtest.cpp
38

#define should not be used in C++11. This can just as well be an inline function (not that I see much point anyway, writing QUrl::fromLocalFile is more readable and not that many more characters)

And the enum values above can be static const int or static const QFileDevice::Permissions.

46

not needed, called by the line below

100

extract this into a different test method

This revision now requires changes to proceed.Sep 3 2017, 8:06 AM

Also please improve the commit log to be more self contained (unit tests for what? And "T6561" will mean nothing to someone doing git log).

How are we doing here?

chinmoyr updated this revision to Diff 24603.Tue, Jan 2, 4:32 PM
chinmoyr retitled this revision from Add unit test to Add unit tests for privilege excution in KIO.
chinmoyr edited the summary of this revision. (Show Details)

1.Removed all macros
2.Removed PrivilegeExecution flag.

Restricted Application added a project: Frameworks. · View Herald TranscriptTue, Jan 2, 4:32 PM
dfaure accepted this revision.Thu, Jan 4, 8:54 AM

Just missing a 'e' in "execution" in the commit log ;)

This revision is now accepted and ready to land.Thu, Jan 4, 8:54 AM
This revision was automatically updated to reflect the committed changes.