-
-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto copy with safecontent #685
Conversation
Wow, this failed for a reason I wasn't expecting:
Should I fix it by adapting the unit test to reflect Travis lack of xsel or xclip, or should I fix it by modifying |
Hi, Please set |
I guess I've misunderstood something there. What's
The problem I'm having seems to be that I'm expecting the copy action to succeed with its standard message, but since Travis isn't featuring xclip, it fails. A solution could be to simply add |
Oh, my bad. I missed the fact that you added an integration test, not a unit test. Just add a new test case here: https://github.com/justwatchcom/gopass/blob/master/action/clipboard_test.go Have a look at the other unit tests on how we mock/capture input/output. Let me know if you need help. |
Actually I think you could just change this line https://github.com/justwatchcom/gopass/pull/685/files#diff-a9331e67576623a133a012a0cfd71beeR40 to This should work. |
True. But it's kind of a workaround and it wouldn't cost me much to add it to the actual unit tests. Is there any benefits to have a same test both as a unit test and as an integration test? (I was thinking those were all unit tests.) |
Both have their merits. Unit tests are much faster and easier to implement, but you need to do a lot of mocking so you might change the behavior without noticing. Integration tests are usually more annoying but they test the final binary without any mocking, so they give greater confidence. |
Codecov Report
@@ Coverage Diff @@
## master #685 +/- ##
==========================================
+ Coverage 64.38% 64.45% +0.08%
==========================================
Files 150 150
Lines 8450 8451 +1
==========================================
+ Hits 5440 5447 +7
+ Misses 2344 2338 -6
Partials 666 666
Continue to review full report at Codecov.
|
Alright, I've workaround all the problems I had... At last! Maybe I should rebase, since I'm reverting a lot of stuff in the end? |
Yes, please rebase onto master |
Done. I haven't squashed everything into just one commit, because those 3 commits are doing 3 different things... But if you want, I can squash everything into just one. |
Adapting the integration tests accordingly. Also adding an integration test to avoid conflict between safecontent and -c in the show action.
No, this is fine. |
Since we have a package out to handle the output and the formatting and coloring, there is no reason to directly use the color package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks a lot!
* Addressing gopasspw#684 Adapting the integration tests accordingly. Also adding an integration test to avoid conflict between safecontent and -c in the show action. * Adding real unit tests * Removing all direct color uses Since we have a package out to handle the output and the formatting and coloring, there is no reason to directly use the color package.
With this, passwords will be copied to clipboard when safecontent is set and there is only a password in the entry invoked.
This is addressing #684.
I've adapted the unit tests accordingly and I've added a unit test to check for conflict between safecontent and -c in the show action. (To avoid regressions later on, as the expected behaviour when specifying -c is to copy to clipboard, not to show the (safe) content)