aboutsummaryrefslogtreecommitdiffstats
path: root/repository/mock_repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/mock_repo.go')
-rw-r--r--repository/mock_repo.go53
1 files changed, 40 insertions, 13 deletions
diff --git a/repository/mock_repo.go b/repository/mock_repo.go
index f5d27d12..e747eb24 100644
--- a/repository/mock_repo.go
+++ b/repository/mock_repo.go
@@ -1,33 +1,60 @@
package repository
import (
- "crypto/sha1"
- "encoding/json"
- "fmt"
+ "github.com/MichaelMure/git-bug/util"
)
// mockRepoForTest defines an instance of Repo that can be used for testing.
type mockRepoForTest struct{}
+func NewMockRepoForTest() Repo {
+ return &mockRepoForTest{}
+}
+
// GetPath returns the path to the repo.
-func (r *mockRepoForTest) GetPath() string { return "~/mockRepo/" }
+func (r *mockRepoForTest) GetPath() string {
+ return "~/mockRepo/"
+}
-// GetRepoStateHash returns a hash which embodies the entire current state of a repository.
-func (r *mockRepoForTest) GetRepoStateHash() (string, error) {
- repoJSON, err := json.Marshal(r)
- if err != nil {
- return "", err
- }
- return fmt.Sprintf("%x", sha1.Sum([]byte(repoJSON))), nil
+func (r *mockRepoForTest) GetUserName() (string, error) {
+ return "René Descartes", nil
}
// GetUserEmail returns the email address that the user has used to configure git.
-func (r *mockRepoForTest) GetUserEmail() (string, error) { return "user@example.com", nil }
+func (r *mockRepoForTest) GetUserEmail() (string, error) {
+ return "user@example.com", nil
+}
// GetCoreEditor returns the name of the editor that the user has used to configure git.
-func (r *mockRepoForTest) GetCoreEditor() (string, error) { return "vi", nil }
+func (r *mockRepoForTest) GetCoreEditor() (string, error) {
+ return "vi", nil
+}
// PushRefs push git refs to a remote
func (r *mockRepoForTest) PushRefs(remote string, refPattern string) error {
return nil
}
+
+func (r *mockRepoForTest) PullRefs(remote string, refPattern string) error {
+ return nil
+}
+
+func (r *mockRepoForTest) StoreData([]byte) (util.Hash, error) {
+ return "", nil
+}
+
+func (r *mockRepoForTest) StoreTree(mapping map[string]util.Hash) (util.Hash, error) {
+ return "", nil
+}
+
+func (r *mockRepoForTest) StoreCommit(treeHash util.Hash) (util.Hash, error) {
+ return "", nil
+}
+
+func (r *mockRepoForTest) StoreCommitWithParent(treeHash util.Hash, parent util.Hash) (util.Hash, error) {
+ return "", nil
+}
+
+func (r *mockRepoForTest) UpdateRef(ref string, hash util.Hash) error {
+ return nil
+}