diff options
author | Michael Muré <batolettre@gmail.com> | 2019-12-08 21:15:06 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-12-08 21:28:27 +0100 |
commit | b92adfcb5f79f2b32c3dafb0fc3e7f1b753b6197 (patch) | |
tree | 69202c4021b10f3ab7b7f5ebf229d501e95c4786 /bridge/gitlab/import_test.go | |
parent | 981a4a848b1329da1a73270e27633911f9298bb1 (diff) | |
download | git-bug-b92adfcb5f79f2b32c3dafb0fc3e7f1b753b6197.tar.gz |
bridge: huge refactor to accept multiple kind of credentials
Diffstat (limited to 'bridge/gitlab/import_test.go')
-rw-r--r-- | bridge/gitlab/import_test.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go index 8e596349..1676bdf3 100644 --- a/bridge/gitlab/import_test.go +++ b/bridge/gitlab/import_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" "github.com/MichaelMure/git-bug/bridge/core" + "github.com/MichaelMure/git-bug/bridge/core/auth" "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/identity" @@ -83,8 +84,8 @@ func TestImport(t *testing.T) { defer backend.Close() interrupt.RegisterCleaner(backend.Close) - token := os.Getenv("GITLAB_API_TOKEN") - if token == "" { + envToken := os.Getenv("GITLAB_API_TOKEN") + if envToken == "" { t.Skip("Env var GITLAB_API_TOKEN missing") } @@ -93,10 +94,16 @@ func TestImport(t *testing.T) { t.Skip("Env var GITLAB_PROJECT_ID missing") } + err = author.Commit(repo) + require.NoError(t, err) + + token := auth.NewToken(author.Id(), envToken, target) + err = auth.Store(repo, token) + require.NoError(t, err) + importer := &gitlabImporter{} - err = importer.Init(core.Configuration{ + err = importer.Init(backend, core.Configuration{ keyProjectID: projectID, - keyToken: token, }) require.NoError(t, err) |