<table><tr><td style="">martinkostolny added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4847" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>I've learnt a few things about autotests (<tt style="background: #ebebeb; font-size: 13px;">KTextEditor::EditorPrivate::unitTestMode()</tt> was really helpful, thanks!). I managed to create a test case, which allowed the code to go through KAuth action. But I was unsuccessful to finish it to my satisfaction - I couldn't come up with a solution where in case of unit testing KAuth dialog is not shown and just allows the execution. <tt style="background: #ebebeb; font-size: 13px;">action.exectute(ExecutionMode::AuthorizeOnlyMode)</tt> will not help here since it does not really execute the action. I also tried to create "autotestsave" action alongside existing "save" action and set it to be always allowed. Then triggered it only from unit test. This worked well but I don't find it safe having such action available in non-testing runtime.</p>

<p>If somebody with better KAuth knowledge would know how to allow running otherwise secured KAuth action in unit-test runtime, that would be really helpful :).</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D4847" rel="noreferrer">https://phabricator.kde.org/D4847</a></div></div><br /><div><strong>To: </strong>martinkostolny, dhaumann, KTextEditor<br /><strong>Cc: </strong>ltoscano, dhaumann, graesslin, davidedmundson, palant, kwrite-devel, Frameworks, head7, cullmann, kfunk, sars<br /></div>