aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-06-23 15:18:56 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-06-24 21:34:52 +0200
commit87cdf03219e7713f041387cbfc3144506a6be9da (patch)
treee607eea3bbf71c03f5e28f2f72050107ad690a2f /bridge
parent9b4b1fc09a9fca1aeb48560a258de8990070b3b5 (diff)
downloadgit-bug-87cdf03219e7713f041387cbfc3144506a6be9da.tar.gz
[bridge/github] exporter tests: Test issues metadata
[bridge/github] exproter tests: Change env vars
Diffstat (limited to 'bridge')
-rw-r--r--bridge/github/export_test.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/bridge/github/export_test.go b/bridge/github/export_test.go
index 0a0c6d95..85f5eb07 100644
--- a/bridge/github/export_test.go
+++ b/bridge/github/export_test.go
@@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/MichaelMure/git-bug/bridge/core"
+ "github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/repository"
"github.com/MichaelMure/git-bug/util/interrupt"
@@ -162,9 +163,9 @@ func testCases(repo *cache.RepoCache, identity *cache.IdentityCache) ([]*testCas
func TestExporter(t *testing.T) {
user := os.Getenv("TEST_USER")
- token := os.Getenv("BOT_TOKEN")
+ token := os.Getenv("GITHUB_TOKEN_ADMIN")
if token == "" {
- t.Skip("Env var GITHUB_TOKEN_PRIVATE missing")
+ t.Skip("Env var GITHUB_TOKEN_ADMIN missing")
}
repo := repository.CreateTestRepo(false)
@@ -252,6 +253,16 @@ func TestExporter(t *testing.T) {
// so number of operations should double
require.Len(t, tt.bug.Snapshot().Operations, tt.numOrOp*2)
+ for _, op := range tt.bug.Snapshot().Operations {
+ if _, ok := op.(*bug.SetMetadataOperation); !ok {
+ _, haveIDMetadata := op.GetMetadata(keyGithubId)
+ require.True(t, haveIDMetadata)
+
+ _, haveURLMetada := op.GetMetadata(keyGithubUrl)
+ require.True(t, haveURLMetada)
+ }
+ }
+
bugGithubID, ok := tt.bug.Snapshot().Operations[0].GetMetadata(keyGithubId)
require.True(t, ok)
@@ -260,6 +271,10 @@ func TestExporter(t *testing.T) {
require.Len(t, importedBug.Snapshot().Operations, tt.numOrOp)
+ issueOrigin, ok := importedBug.Snapshot().Operations[0].GetMetadata(keyOrigin)
+ require.True(t, ok)
+ require.Equal(t, issueOrigin, target)
+
for _, _ = range importedBug.Snapshot().Operations {
// test operations or last bug state ?
}