aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/github/export_test.go')
-rw-r--r--bridge/github/export_test.go28
1 files changed, 17 insertions, 11 deletions
diff --git a/bridge/github/export_test.go b/bridge/github/export_test.go
index 2ebe9622..a2dbf7de 100644
--- a/bridge/github/export_test.go
+++ b/bridge/github/export_test.go
@@ -34,18 +34,18 @@ type testCase struct {
func testCases(t *testing.T, repo *cache.RepoCache) []*testCase {
// simple bug
- simpleBug, _, err := repo.NewBug("simple bug", "new bug")
+ simpleBug, _, err := repo.Bugs().New("simple bug", "new bug")
require.NoError(t, err)
// bug with comments
- bugWithComments, _, err := repo.NewBug("bug with comments", "new bug")
+ bugWithComments, _, err := repo.Bugs().New("bug with comments", "new bug")
require.NoError(t, err)
_, _, err = bugWithComments.AddComment("new comment")
require.NoError(t, err)
// bug with label changes
- bugLabelChange, _, err := repo.NewBug("bug label change", "new bug")
+ bugLabelChange, _, err := repo.Bugs().New("bug label change", "new bug")
require.NoError(t, err)
_, _, err = bugLabelChange.ChangeLabels([]string{"bug"}, nil)
@@ -64,7 +64,7 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase {
require.NoError(t, err)
// bug with comments editions
- bugWithCommentEditions, createOp, err := repo.NewBug("bug with comments editions", "new bug")
+ bugWithCommentEditions, createOp, err := repo.Bugs().New("bug with comments editions", "new bug")
require.NoError(t, err)
_, err = bugWithCommentEditions.EditComment(
@@ -78,7 +78,7 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase {
require.NoError(t, err)
// bug status changed
- bugStatusChanged, _, err := repo.NewBug("bug status changed", "new bug")
+ bugStatusChanged, _, err := repo.Bugs().New("bug status changed", "new bug")
require.NoError(t, err)
_, err = bugStatusChanged.Close()
@@ -88,7 +88,7 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase {
require.NoError(t, err)
// bug title changed
- bugTitleEdited, _, err := repo.NewBug("bug title edited", "new bug")
+ bugTitleEdited, _, err := repo.Bugs().New("bug title edited", "new bug")
require.NoError(t, err)
_, err = bugTitleEdited.SetTitle("bug title edited again")
@@ -141,12 +141,15 @@ func TestGithubPushPull(t *testing.T) {
// create repo backend
repo := repository.CreateGoGitTestRepo(t, false)
- backend, err := cache.NewRepoCache(repo)
+ backend, events, err := cache.NewRepoCache(repo)
require.NoError(t, err)
+ for event := range events {
+ require.NoError(t, event.Err)
+ }
// set author identity
login := "identity-test"
- author, err := backend.NewIdentity("test identity", "test@test.org")
+ author, err := backend.Identities().New("test identity", "test@test.org")
require.NoError(t, err)
author.SetMetadata(metaKeyGithubLogin, login)
err = author.Commit()
@@ -217,8 +220,11 @@ func TestGithubPushPull(t *testing.T) {
repoTwo := repository.CreateGoGitTestRepo(t, false)
// create a second backend
- backendTwo, err := cache.NewRepoCache(repoTwo)
+ backendTwo, events, err := cache.NewRepoCache(repoTwo)
require.NoError(t, err)
+ for event := range events {
+ require.NoError(t, event.Err)
+ }
importer := &githubImporter{}
err = importer.Init(ctx, backend, core.Configuration{
@@ -236,7 +242,7 @@ func TestGithubPushPull(t *testing.T) {
require.NoError(t, result.Err)
}
- require.Len(t, backendTwo.AllBugsIds(), len(tests))
+ require.Len(t, backendTwo.Bugs().AllIds(), len(tests))
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -261,7 +267,7 @@ func TestGithubPushPull(t *testing.T) {
require.True(t, ok)
// retrieve bug from backendTwo
- importedBug, err := backendTwo.ResolveBugCreateMetadata(metaKeyGithubId, bugGithubID)
+ importedBug, err := backendTwo.Bugs().ResolveBugCreateMetadata(metaKeyGithubId, bugGithubID)
require.NoError(t, err)
// verify bug have same number of original operations