-
Notifications
You must be signed in to change notification settings - Fork 304
Added code to ensure that passwords are not included git.remote.origin.url #241
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package pl.project13.maven.git; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
|
|
||
| import org.apache.http.client.utils.URIBuilder; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
|
|
||
| import java.net.MalformedURLException; | ||
| import java.net.URI; | ||
| import java.net.URISyntaxException; | ||
| import java.net.URL; | ||
|
|
||
| /** | ||
| * Created by ryan on 3/21/16. | ||
| */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I try to not include any I'll clean that up. |
||
| public class UriUserInfoRemoverTest { | ||
|
|
||
| @Test | ||
| public void testHttpsUriWithoutUserInfo() throws Exception { | ||
| String result = GitDataProvider.stripCredentialsFromOriginUrl("https://example.com"); | ||
| assertEquals("https://example.com", result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testHttpsUriWithUserInfo() throws Exception { | ||
| String result = GitDataProvider.stripCredentialsFromOriginUrl("https://user@example.com"); | ||
| assertEquals("https://user@example.com", result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testHttpsUriWithUserInfoAndPassword() throws Exception { | ||
| String result = GitDataProvider.stripCredentialsFromOriginUrl("https://user:password@example.com"); | ||
| assertEquals("https://user@example.com", result); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| } | ||
|
|
||
| @Test | ||
| public void testWithSCPStyleSSHProtocolGitHub() throws Exception { | ||
| String result = GitDataProvider.stripCredentialsFromOriginUrl("git@github.com"); | ||
| assertEquals("git@github.com",result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testWithSCPStyleSSHProtocol() throws Exception { | ||
| String result = GitDataProvider.stripCredentialsFromOriginUrl("user@host.xz:~user/path/to/repo.git"); | ||
| assertEquals("user@host.xz:~user/path/to/repo.git",result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testWithSSHUri() throws Exception { | ||
| String result = GitDataProvider.stripCredentialsFromOriginUrl("ssh://git@github.com/"); | ||
| assertEquals("ssh://git@github.com/",result); | ||
| } | ||
| } | ||
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.
missing license header, I'll add