aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/export_test.go
diff options
context:
space:
mode:
authoramine <hilalyamine@gmail.com>2019-12-10 20:30:29 +0100
committeramine <hilalyamine@gmail.com>2019-12-10 21:05:55 +0100
commitf6b4830c0b68f3b5c616236bc9d51943765c8b4a (patch)
tree324f36a49d1a26253bb1fc1ecc923d50aaed2912 /bridge/gitlab/export_test.go
parentf1ed857cbd3a253d77b31c0c896fdc4ade40844f (diff)
downloadgit-bug-f6b4830c0b68f3b5c616236bc9d51943765c8b4a.tar.gz
bridge/gitlab: support self-hosted GitLab instance
Diffstat (limited to 'bridge/gitlab/export_test.go')
-rw-r--r--bridge/gitlab/export_test.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/bridge/gitlab/export_test.go b/bridge/gitlab/export_test.go
index 645e2d76..d16defd0 100644
--- a/bridge/gitlab/export_test.go
+++ b/bridge/gitlab/export_test.go
@@ -188,7 +188,8 @@ func TestPushPull(t *testing.T) {
// initialize exporter
exporter := &gitlabExporter{}
err = exporter.Init(backend, core.Configuration{
- keyProjectID: strconv.Itoa(projectID),
+ keyProjectID: strconv.Itoa(projectID),
+ keyGitlabBaseUrl: "https://gitlab.com/",
})
require.NoError(t, err)
@@ -215,7 +216,8 @@ func TestPushPull(t *testing.T) {
importer := &gitlabImporter{}
err = importer.Init(backend, core.Configuration{
- keyProjectID: strconv.Itoa(projectID),
+ keyProjectID: strconv.Itoa(projectID),
+ keyGitlabBaseUrl: "https://gitlab.com/",
})
require.NoError(t, err)
@@ -280,7 +282,11 @@ func generateRepoName() string {
// create repository need a token with scope 'repo'
func createRepository(ctx context.Context, name string, token *auth.Token) (int, error) {
- client := buildClient(token)
+ client, err := buildClient("https://gitlab.com/", token)
+ if err != nil {
+ return 0, err
+ }
+
project, _, err := client.Projects.CreateProject(
&gitlab.CreateProjectOptions{
Name: gitlab.String(name),
@@ -296,7 +302,11 @@ func createRepository(ctx context.Context, name string, token *auth.Token) (int,
// delete repository need a token with scope 'delete_repo'
func deleteRepository(ctx context.Context, project int, token *auth.Token) error {
- client := buildClient(token)
- _, err := client.Projects.DeleteProject(project, gitlab.WithContext(ctx))
+ client, err := buildClient("https://gitlab.com/", token)
+ if err != nil {
+ return err
+ }
+
+ _, err = client.Projects.DeleteProject(project, gitlab.WithContext(ctx))
return err
}