-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move gitlab client setup into constructor.
- Loading branch information
Showing
3 changed files
with
79 additions
and
30 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package vcs | ||
|
||
import ( | ||
. "github.com/runatlantis/atlantis/testing" | ||
"testing" | ||
) | ||
|
||
// Test that the base url gets set properly. | ||
func TestNewGitlabClient_BaseURL(t *testing.T) { | ||
cases := []struct { | ||
Hostname string | ||
ExpBaseURL string | ||
}{ | ||
{ | ||
"gitlab.com", | ||
"https://gitlab.com/api/v4/", | ||
}, | ||
{ | ||
"http://custom.domain", | ||
"http://custom.domain/api/v4/", | ||
}, | ||
{ | ||
"https://custom.domain", | ||
"https://custom.domain/api/v4/", | ||
}, | ||
} | ||
|
||
for _, c := range cases { | ||
t.Run(c.Hostname, func(t *testing.T) { | ||
client, err := NewGitlabClient(c.Hostname, "token", nil) | ||
Ok(t, err) | ||
Equals(t, c.ExpBaseURL, client.Client.BaseURL().String()) | ||
}) | ||
} | ||
} |
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