-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- NewRepo() encodes clone URLs that contain spaces
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 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
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 |
---|---|---|
|
@@ -66,6 +66,19 @@ func TestNewRepo_CloneURLBitbucketServer(t *testing.T) { | |
}, repo) | ||
} | ||
|
||
// If the clone URL contains a space, NewRepo() should encode it | ||
func TestNewRepo_CloneURLContainsSpace(t *testing.T) { | ||
repo, err := models.NewRepo(models.AzureDevops, "owner/project space/repo", "https://dev.azure.com/owner/project space/repo", "u", "p") | ||
Ok(t, err) | ||
Equals(t, repo.CloneURL, "https://u:[email protected]/owner/project%20space/repo") | ||
Equals(t, repo.SanitizedCloneURL, "https://u:<redacted>@dev.azure.com/owner/project%20space/repo") | ||
|
||
repo, err = models.NewRepo(models.BitbucketCloud, "owner/repo space", "https://bitbucket.org/owner/repo space", "u", "p") | ||
Ok(t, err) | ||
Equals(t, repo.CloneURL, "https://u:[email protected]/owner/repo%20space.git") | ||
Equals(t, repo.SanitizedCloneURL, "https://u:<redacted>@bitbucket.org/owner/repo%20space.git") | ||
} | ||
|
||
func TestNewRepo_FullNameWrongFormat(t *testing.T) { | ||
cases := []struct { | ||
repoFullName string | ||
|