HostingServices can check if SSH keys are associated
Review Request #3478 — Created Nov. 7, 2012 and submitted
Automatic SSH key association should only be performed if the key has not already been associated. HostingServices that support SSH key association now have the capability to report if a given key has been associated with a given repository. Currently, only the GitHub HostingService supports SSH key association.
Added unit test for code that checks if a key has been associated. Made slight adjustment to key association test to ensure tests pass (given that a helper method for SSH key association API calls was added). Both unit tests pass. Tested manually with an existing GitHub repository by: 1) adding RB server's (dev server's) SSH key to list of repository deploy keys. Check confirmed key was associated. 2) adding SSH key to list of user keys. Check confirmed key was associated. 3) ensuring key NOT associated with repository. Check confirmed key NOT associated. 4) ensured associate_ssh_key still works as normal for GitHub.
Description | From | Last Updated |
---|---|---|
No blank line. |
chipx86 | |
Instead of formatting it this way, do: ('%suser/keys?access_token=%s' % (self.API_URL, ....)) |
chipx86 | |
It'd be nice to change the code to, at the best case, only check one batch of keys. So, get … |
chipx86 | |
this can just be: return formatted_key in keys |
chipx86 | |
Why are we factoring this out? Will more things be calling this? |
chipx86 | |
Missing period. |
chipx86 | |
``key`` |
chipx86 | |
``repository`` |
chipx86 | |
One dict per line. |
chipx86 | |
Let's precompute this once outside the function. |
chipx86 | |
Can you align the "if" with the "for" in the previous line? |
david | |
Why did you change the single backticks to be double backticks? |
david | |
Just so the entire function doesn't have to be indented, it'd be nice to just do: if not key: return … |
chipx86 | |
I know this has gone back and forth a couple times, but really, multi-line like this should be: deploy_keys = … |
chipx86 | |
Space after : |
chipx86 | |
Continuation line indentation is not a multiple of four |
JS jsintal | |
line too long (80 > 79 characters) |
JS jsintal | |
This can be simplified to: for url in (url_deploy_keys, url_user_keys): keys_rsp = self._key_association_api_call(...) blah blah if formatted_key in ... return … |
chipx86 | |
*args, **kwargs. We shouldn't stray from the naming convention. |
chipx86 | |
Trailing period. |
chipx86 | |
continuation line does not distinguish itself from next logical line. So, just make one indent here. |
JS jsintal | |
line too long |
JS jsintal |
-
I think after this one last set of changes, which are tiny, we'll be ready to ship it :D
-
This can be simplified to: for url in (url_deploy_keys, url_user_keys): keys_rsp = self._key_association_api_call(...) blah blah if formatted_key in ... return True Also, I'd prefer that "url" and "rsp" be suffixes, not prefixes.
-
-