aboutsummaryrefslogtreecommitdiffstats
path: root/entity/dag/common_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-02-05 11:18:38 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:19:01 +0100
commite35c7c4d170d1b682992c95f1c14772158501015 (patch)
treefdebdffa3e531ca3494c66627ba3396214a792d9 /entity/dag/common_test.go
parentfe4237df3c62bd6dfd1f385893295f93072d0e51 (diff)
downloadgit-bug-e35c7c4d170d1b682992c95f1c14772158501015.tar.gz
entity: more testing and bug fixing
Diffstat (limited to 'entity/dag/common_test.go')
-rw-r--r--entity/dag/common_test.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/entity/dag/common_test.go b/entity/dag/common_test.go
index b822fc79..05d85898 100644
--- a/entity/dag/common_test.go
+++ b/entity/dag/common_test.go
@@ -3,6 +3,9 @@ package dag
import (
"encoding/json"
"fmt"
+ "testing"
+
+ "github.com/stretchr/testify/require"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/identity"
@@ -94,23 +97,28 @@ func makeTestContext() (repository.ClockedRepo, identity.Interface, identity.Int
return repo, id1, id2, def
}
-func makeTestContextRemote() (repository.ClockedRepo, repository.ClockedRepo, repository.ClockedRepo, identity.Interface, identity.Interface, Definition) {
+func makeTestContextRemote(t *testing.T) (repository.ClockedRepo, repository.ClockedRepo, repository.ClockedRepo, identity.Interface, identity.Interface, Definition) {
repoA := repository.CreateGoGitTestRepo(false)
repoB := repository.CreateGoGitTestRepo(false)
remote := repository.CreateGoGitTestRepo(true)
- err := repoA.AddRemote("origin", remote.GetLocalRemote())
- if err != nil {
- panic(err)
- }
-
- err = repoB.AddRemote("origin", remote.GetLocalRemote())
- if err != nil {
- panic(err)
- }
+ err := repoA.AddRemote("remote", remote.GetLocalRemote())
+ require.NoError(t, err)
+ err = repoA.AddRemote("repoB", repoB.GetLocalRemote())
+ require.NoError(t, err)
+ err = repoB.AddRemote("remote", remote.GetLocalRemote())
+ require.NoError(t, err)
+ err = repoB.AddRemote("repoA", repoA.GetLocalRemote())
+ require.NoError(t, err)
id1, id2, def := makeTestContextInternal(repoA)
+ // distribute the identities
+ _, err = identity.Push(repoA, "remote")
+ require.NoError(t, err)
+ err = identity.Pull(repoB, "remote")
+ require.NoError(t, err)
+
return repoA, repoB, remote, id1, id2, def
}