-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assert tokens are redacted in origin URL when username is not specified
- Loading branch information
1 parent
56ed9be
commit 2ead24d
Showing
1 changed file
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,7 +209,31 @@ func TestRepositoryGitConfigWhenNotARepo(t *testing.T) { | |
} | ||
|
||
func TestRepositoryOriginUrlRemovesUserCreds(t *testing.T) { | ||
repo := newTestRepository(t) | ||
repo.addOriginUrl("https://username:[email protected]/databricks/foobar.git") | ||
repo.assertOriginUrl("https://github.com/databricks/foobar.git") | ||
tcases := []struct { | ||
url string | ||
expected string | ||
}{ | ||
{ | ||
url: "https://username:[email protected]/databricks/foobar.git", | ||
expected: "https://github.com/databricks/foobar.git", | ||
}, | ||
{ | ||
url: "https://[email protected]/databricks/foobar.git", | ||
expected: "https://github.com/databricks/foobar.git", | ||
}, | ||
{ | ||
url: "https://johndoe:[email protected]/mycompany/myproject/_git/myrepo", | ||
expected: "https://dev.azure.com/mycompany/myproject/_git/myrepo", | ||
}, | ||
{ | ||
url: "https://[email protected]/mycompany/myproject/_git/myrepo", | ||
expected: "https://dev.azure.com/mycompany/myproject/_git/myrepo", | ||
}, | ||
} | ||
|
||
for _, tc := range tcases { | ||
repo := newTestRepository(t) | ||
repo.addOriginUrl(tc.url) | ||
repo.assertOriginUrl(tc.expected) | ||
} | ||
} |