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
Added unlock_keychain action #580
Conversation
end | ||
end | ||
|
||
return false |
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.
Redundant return
detected.
module Actions | ||
class UnlockKeychainAction < Action | ||
def self.run(params) | ||
@keychain_path = params[:path] |
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.
Is it necessary to use @keychain_path
? You could pass the keychain path from the run
method to the other methods, right?
I'd prefer to not store anything in the action itself.
This looks like a great addition, thank you for your contribution @xfreebird 👍 I added some notes. Also, could you add 1 or 2 simple test cases? I saw you have the Take a look at the other action specs, let me know if you need help with that. Run the tests using Thanks again for your great contribution 🚀 |
expect(result[3]).to include '-u' | ||
expect(result[3]).to include '~/Library/Keychains/test.keychain' | ||
expect(result[0]).to eq "security unlock-keychain -p testpassword #{expanded_path}" | ||
expect(result[1]).to eq "security set-keychain-settings #{expanded_path}" |
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.
Line is too long. [81/80]
Oh, sorry about those @houndci messages, somehow it didn't fetch the latest style configuration. |
Do you need help with adding the tests? |
end | ||
end | ||
end | ||
end |
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.
Final newline missing.
end | ||
end | ||
|
||
return "" |
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.
Redundant return
detected.
sorry about that, I added the wrong content to the spec file :) Anyway I still don't quite good understand what exactly does runner.execute returns in spec ? I'm very new to ruby, so please understand my simple mistakes. |
describe "Unlock keychain Integration" do | ||
|
||
it "works with path and password and existing keychain" do | ||
keychain_path = Tempfile.new('foo').path |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Thanks for your contribution @xfreebird, this is now merged and will be in the next release later today 🚀 |
Thanks @KrauseFx ! |
Added a new action unlock_keychain. It allows the user to unlock a given keychain, also it adds it to the keychain search list.
This is useful because it doesn't require to set a specific keychain as the default one, which might make issues when some program tries to access specific items from former keychains while being locked.