diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-25 17:56:58 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-25 17:56:58 +0200 |
commit | 40c6e64e4badfd543dc98237e1aeb3d8958cfe90 (patch) | |
tree | 03a992d71a1bfa3f069a5ef179649c0cf8479764 /tests | |
parent | 5d7c3a76af85a857a6bb0bff5bac5282c0a9908f (diff) | |
download | git-bug-40c6e64e4badfd543dc98237e1aeb3d8958cfe90.tar.gz |
cache: add raw edit functions to allow setting up the author, the timestamp and the metadatas
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bug_actions_test.go | 70 | ||||
-rw-r--r-- | tests/operation_iterator_test.go | 13 | ||||
-rw-r--r-- | tests/operation_pack_test.go | 4 |
3 files changed, 45 insertions, 42 deletions
diff --git a/tests/bug_actions_test.go b/tests/bug_actions_test.go index b8720842..50333cd2 100644 --- a/tests/bug_actions_test.go +++ b/tests/bug_actions_test.go @@ -71,7 +71,7 @@ func TestPushPull(t *testing.T) { repoA, repoB, remote := setupRepos(t) defer cleanupRepos(repoA, repoB, remote) - bug1, err := operations.Create(rene, "bug1", "message") + bug1, err := operations.Create(rene, unix, "bug1", "message") checkErr(t, err) err = bug1.Commit(repoA) checkErr(t, err) @@ -90,7 +90,7 @@ func TestPushPull(t *testing.T) { } // B --> remote --> A - bug2, err := operations.Create(rene, "bug2", "message") + bug2, err := operations.Create(rene, unix, "bug2", "message") checkErr(t, err) err = bug2.Commit(repoB) checkErr(t, err) @@ -139,7 +139,7 @@ func _RebaseTheirs(t testing.TB) { repoA, repoB, remote := setupRepos(t) defer cleanupRepos(repoA, repoB, remote) - bug1, err := operations.Create(rene, "bug1", "message") + bug1, err := operations.Create(rene, unix, "bug1", "message") checkErr(t, err) err = bug1.Commit(repoA) checkErr(t, err) @@ -155,9 +155,9 @@ func _RebaseTheirs(t testing.TB) { bug2, err := bug.ReadLocalBug(repoB, bug1.Id()) checkErr(t, err) - operations.Comment(bug2, rene, "message2") - operations.Comment(bug2, rene, "message3") - operations.Comment(bug2, rene, "message4") + operations.Comment(bug2, rene, unix, "message2") + operations.Comment(bug2, rene, unix, "message3") + operations.Comment(bug2, rene, unix, "message4") err = bug2.Commit(repoB) checkErr(t, err) @@ -197,7 +197,7 @@ func _RebaseOurs(t testing.TB) { repoA, repoB, remote := setupRepos(t) defer cleanupRepos(repoA, repoB, remote) - bug1, err := operations.Create(rene, "bug1", "message") + bug1, err := operations.Create(rene, unix, "bug1", "message") checkErr(t, err) err = bug1.Commit(repoA) checkErr(t, err) @@ -210,21 +210,21 @@ func _RebaseOurs(t testing.TB) { err = bug.Pull(repoB, "origin") checkErr(t, err) - operations.Comment(bug1, rene, "message2") - operations.Comment(bug1, rene, "message3") - operations.Comment(bug1, rene, "message4") + operations.Comment(bug1, rene, unix, "message2") + operations.Comment(bug1, rene, unix, "message3") + operations.Comment(bug1, rene, unix, "message4") err = bug1.Commit(repoA) checkErr(t, err) - operations.Comment(bug1, rene, "message5") - operations.Comment(bug1, rene, "message6") - operations.Comment(bug1, rene, "message7") + operations.Comment(bug1, rene, unix, "message5") + operations.Comment(bug1, rene, unix, "message6") + operations.Comment(bug1, rene, unix, "message7") err = bug1.Commit(repoA) checkErr(t, err) - operations.Comment(bug1, rene, "message8") - operations.Comment(bug1, rene, "message9") - operations.Comment(bug1, rene, "message10") + operations.Comment(bug1, rene, unix, "message8") + operations.Comment(bug1, rene, unix, "message9") + operations.Comment(bug1, rene, unix, "message10") err = bug1.Commit(repoA) checkErr(t, err) @@ -269,7 +269,7 @@ func _RebaseConflict(t testing.TB) { repoA, repoB, remote := setupRepos(t) defer cleanupRepos(repoA, repoB, remote) - bug1, err := operations.Create(rene, "bug1", "message") + bug1, err := operations.Create(rene, unix, "bug1", "message") checkErr(t, err) err = bug1.Commit(repoA) checkErr(t, err) @@ -282,42 +282,42 @@ func _RebaseConflict(t testing.TB) { err = bug.Pull(repoB, "origin") checkErr(t, err) - operations.Comment(bug1, rene, "message2") - operations.Comment(bug1, rene, "message3") - operations.Comment(bug1, rene, "message4") + operations.Comment(bug1, rene, unix, "message2") + operations.Comment(bug1, rene, unix, "message3") + operations.Comment(bug1, rene, unix, "message4") err = bug1.Commit(repoA) checkErr(t, err) - operations.Comment(bug1, rene, "message5") - operations.Comment(bug1, rene, "message6") - operations.Comment(bug1, rene, "message7") + operations.Comment(bug1, rene, unix, "message5") + operations.Comment(bug1, rene, unix, "message6") + operations.Comment(bug1, rene, unix, "message7") err = bug1.Commit(repoA) checkErr(t, err) - operations.Comment(bug1, rene, "message8") - operations.Comment(bug1, rene, "message9") - operations.Comment(bug1, rene, "message10") + operations.Comment(bug1, rene, unix, "message8") + operations.Comment(bug1, rene, unix, "message9") + operations.Comment(bug1, rene, unix, "message10") err = bug1.Commit(repoA) checkErr(t, err) bug2, err := bug.ReadLocalBug(repoB, bug1.Id()) checkErr(t, err) - operations.Comment(bug2, rene, "message11") - operations.Comment(bug2, rene, "message12") - operations.Comment(bug2, rene, "message13") + operations.Comment(bug2, rene, unix, "message11") + operations.Comment(bug2, rene, unix, "message12") + operations.Comment(bug2, rene, unix, "message13") err = bug2.Commit(repoB) checkErr(t, err) - operations.Comment(bug2, rene, "message14") - operations.Comment(bug2, rene, "message15") - operations.Comment(bug2, rene, "message16") + operations.Comment(bug2, rene, unix, "message14") + operations.Comment(bug2, rene, unix, "message15") + operations.Comment(bug2, rene, unix, "message16") err = bug2.Commit(repoB) checkErr(t, err) - operations.Comment(bug2, rene, "message17") - operations.Comment(bug2, rene, "message18") - operations.Comment(bug2, rene, "message19") + operations.Comment(bug2, rene, unix, "message17") + operations.Comment(bug2, rene, unix, "message18") + operations.Comment(bug2, rene, unix, "message19") err = bug2.Commit(repoB) checkErr(t, err) diff --git a/tests/operation_iterator_test.go b/tests/operation_iterator_test.go index 52778e71..524a639c 100644 --- a/tests/operation_iterator_test.go +++ b/tests/operation_iterator_test.go @@ -5,6 +5,7 @@ import ( "github.com/MichaelMure/git-bug/operations" "github.com/MichaelMure/git-bug/repository" "testing" + "time" ) var ( @@ -13,11 +14,13 @@ var ( Email: "rene@descartes.fr", } - createOp = operations.NewCreateOp(rene, "title", "message", nil) - setTitleOp = operations.NewSetTitleOp(rene, "title2", "title1") - addCommentOp = operations.NewAddCommentOp(rene, "message2", nil) - setStatusOp = operations.NewSetStatusOp(rene, bug.ClosedStatus) - labelChangeOp = operations.NewLabelChangeOperation(rene, []bug.Label{"added"}, []bug.Label{"removed"}) + unix = time.Now().Unix() + + createOp = operations.NewCreateOp(rene, unix, "title", "message", nil) + setTitleOp = operations.NewSetTitleOp(rene, unix, "title2", "title1") + addCommentOp = operations.NewAddCommentOp(rene, unix, "message2", nil) + setStatusOp = operations.NewSetStatusOp(rene, unix, bug.ClosedStatus) + labelChangeOp = operations.NewLabelChangeOperation(rene, unix, []bug.Label{"added"}, []bug.Label{"removed"}) ) func TestOpIterator(t *testing.T) { diff --git a/tests/operation_pack_test.go b/tests/operation_pack_test.go index d7393c29..aab1f1c9 100644 --- a/tests/operation_pack_test.go +++ b/tests/operation_pack_test.go @@ -19,7 +19,7 @@ func TestOperationPackSerialize(t *testing.T) { opp.Append(setStatusOp) opp.Append(labelChangeOp) - opMeta := operations.NewCreateOp(rene, "title", "message", nil) + opMeta := operations.NewCreateOp(rene, unix, "title", "message", nil) opMeta.SetMetadata("key", "value") opp.Append(opMeta) @@ -27,7 +27,7 @@ func TestOperationPackSerialize(t *testing.T) { t.Fatal() } - opFile := operations.NewCreateOp(rene, "title", "message", []git.Hash{ + opFile := operations.NewCreateOp(rene, unix, "title", "message", []git.Hash{ "abcdef", "ghijkl", }) |