diff options
author | amine <hilalyamine@gmail.com> | 2019-12-10 20:30:29 +0100 |
---|---|---|
committer | amine <hilalyamine@gmail.com> | 2019-12-10 21:05:55 +0100 |
commit | f6b4830c0b68f3b5c616236bc9d51943765c8b4a (patch) | |
tree | 324f36a49d1a26253bb1fc1ecc923d50aaed2912 /bridge/gitlab/export_test.go | |
parent | f1ed857cbd3a253d77b31c0c896fdc4ade40844f (diff) | |
download | git-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.go | 20 |
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 } |