diff options
author | Michael Muré <batolettre@gmail.com> | 2021-04-04 15:49:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 15:49:16 +0200 |
commit | fc04af34f5d6dff930003cc1f27ead972d424324 (patch) | |
tree | 8b9750d46182fff88d72fcc891e89d5a79ed83b0 /identity/identity_actions_test.go | |
parent | 2055bd5d0afb534cc98cd11bd9802d66acbb0c8f (diff) | |
parent | cb9b06551ddc1fae33046733f79ede20f8d09f9a (diff) | |
download | git-bug-fc04af34f5d6dff930003cc1f27ead972d424324.tar.gz |
Merge pull request #532 from MichaelMure/dag-entity
Work towards a reusable entity datastructure + commit signature
Diffstat (limited to 'identity/identity_actions_test.go')
-rw-r--r-- | identity/identity_actions_test.go | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/identity/identity_actions_test.go b/identity/identity_actions_test.go index 773574c6..2a5954d6 100644 --- a/identity/identity_actions_test.go +++ b/identity/identity_actions_test.go @@ -8,12 +8,13 @@ import ( "github.com/MichaelMure/git-bug/repository" ) -func TestPushPull(t *testing.T) { - repoA, repoB, remote := repository.SetupReposAndRemote() +func TestIdentityPushPull(t *testing.T) { + repoA, repoB, remote := repository.SetupGoGitReposAndRemote() defer repository.CleanupTestRepos(repoA, repoB, remote) - identity1 := NewIdentity("name1", "email1") - err := identity1.Commit(repoA) + identity1, err := NewIdentity(repoA, "name1", "email1") + require.NoError(t, err) + err = identity1.Commit(repoA) require.NoError(t, err) // A --> remote --> B @@ -30,7 +31,8 @@ func TestPushPull(t *testing.T) { } // B --> remote --> A - identity2 := NewIdentity("name2", "email2") + identity2, err := NewIdentity(repoB, "name2", "email2") + require.NoError(t, err) err = identity2.Commit(repoB) require.NoError(t, err) @@ -48,17 +50,19 @@ func TestPushPull(t *testing.T) { // Update both - identity1.addVersionForTest(&Version{ - name: "name1b", - email: "email1b", + err = identity1.Mutate(repoA, func(orig *Mutator) { + orig.Name = "name1b" + orig.Email = "email1b" }) + require.NoError(t, err) err = identity1.Commit(repoA) require.NoError(t, err) - identity2.addVersionForTest(&Version{ - name: "name2b", - email: "email2b", + err = identity2.Mutate(repoB, func(orig *Mutator) { + orig.Name = "name2b" + orig.Email = "email2b" }) + require.NoError(t, err) err = identity2.Commit(repoB) require.NoError(t, err) @@ -92,20 +96,22 @@ func TestPushPull(t *testing.T) { // Concurrent update - identity1.addVersionForTest(&Version{ - name: "name1c", - email: "email1c", + err = identity1.Mutate(repoA, func(orig *Mutator) { + orig.Name = "name1c" + orig.Email = "email1c" }) + require.NoError(t, err) err = identity1.Commit(repoA) require.NoError(t, err) identity1B, err := ReadLocal(repoB, identity1.Id()) require.NoError(t, err) - identity1B.addVersionForTest(&Version{ - name: "name1concurrent", - email: "email1concurrent", + err = identity1B.Mutate(repoB, func(orig *Mutator) { + orig.Name = "name1concurrent" + orig.Email = "name1concurrent" }) + require.NoError(t, err) err = identity1B.Commit(repoB) require.NoError(t, err) |