-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get the right credentials for bosh release repo release listing
Co-Authored-By: Ajita Jain <[email protected]>
- Loading branch information
Showing
4 changed files
with
60 additions
and
19 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 |
---|---|---|
|
@@ -13,23 +13,29 @@ func Test_RepositoryOwnerAndNameFromPath(t *testing.T) { | |
Name, | ||
URI, | ||
RepositoryOwner, RepositoryName, | ||
RepositoryHost, | ||
ErrorSubstring string | ||
}{ | ||
{ | ||
Name: "valid url", | ||
URI: "https://github.com/crhntr/hello-release", | ||
RepositoryOwner: "crhntr", RepositoryName: "hello-release", | ||
RepositoryOwner: "crhntr", RepositoryName: "hello-release", RepositoryHost: "github.com", | ||
}, | ||
{ | ||
Name: "ssh url", | ||
URI: "[email protected]:crhntr/hello-release.git", | ||
RepositoryOwner: "crhntr", RepositoryName: "hello-release", | ||
RepositoryOwner: "crhntr", RepositoryName: "hello-release", RepositoryHost: "github.com", | ||
}, | ||
{ | ||
Name: "empty ssh path", | ||
URI: "[email protected]:", | ||
ErrorSubstring: "path missing expected parts", | ||
}, | ||
{ | ||
Name: "github enterprise", | ||
URI: "[email protected]:x/y.git", | ||
RepositoryOwner: "x", RepositoryName: "y", RepositoryHost: "example.com", | ||
}, | ||
{ | ||
Name: "not a valid ssh path", | ||
URI: "[email protected]:?invalid_url?", | ||
|
@@ -52,13 +58,24 @@ func Test_RepositoryOwnerAndNameFromPath(t *testing.T) { | |
}, | ||
} { | ||
t.Run(tt.Name, func(t *testing.T) { | ||
repoOwner, repoName, err := gh.RepositoryOwnerAndNameFromPath(tt.URI) | ||
repoHost, repoOwner, repoName, err := gh.RepositoryHostOwnerAndNameFromPath(tt.URI) | ||
if tt.ErrorSubstring != "" { | ||
require.ErrorContains(t, err, tt.ErrorSubstring) | ||
} else { | ||
require.NoError(t, err) | ||
assert.Equal(t, tt.RepositoryOwner, repoOwner) | ||
assert.Equal(t, tt.RepositoryName, repoName) | ||
assert.Equal(t, tt.RepositoryHost, repoHost) | ||
} | ||
|
||
repoOwner, repoName, err = gh.RepositoryOwnerAndNameFromPath(tt.URI) | ||
if tt.ErrorSubstring != "" { | ||
require.ErrorContains(t, err, tt.ErrorSubstring) | ||
} else { | ||
require.NoError(t, err) | ||
assert.Equal(t, tt.RepositoryOwner, repoOwner) | ||
assert.Equal(t, tt.RepositoryName, repoName) | ||
assert.Equal(t, tt.RepositoryHost, repoHost) | ||
} | ||
}) | ||
} | ||
|
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