aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/export_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-12-10 21:13:54 +0100
committerGitHub <noreply@github.com>2019-12-10 21:13:54 +0100
commite96d8e6771086e20639a16abf6af30f2faa006a0 (patch)
tree606c0d2897c06e4ca226d377917437c62fdd1560 /bridge/gitlab/export_test.go
parentef6801a37f75fbc5f65b0a5db194b7f88b439e7b (diff)
parentf6b4830c0b68f3b5c616236bc9d51943765c8b4a (diff)
downloadgit-bug-e96d8e6771086e20639a16abf6af30f2faa006a0.tar.gz
Merge pull request #274 from MichaelMure/gitlab-bridge
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
}