mock_repo.go

 1package repository
 2
 3import (
 4	"github.com/MichaelMure/git-bug/util"
 5)
 6
 7// mockRepoForTest defines an instance of Repo that can be used for testing.
 8type mockRepoForTest struct{}
 9
10func NewMockRepoForTest() Repo {
11	return &mockRepoForTest{}
12}
13
14// GetPath returns the path to the repo.
15func (r *mockRepoForTest) GetPath() string {
16	return "~/mockRepo/"
17}
18
19func (r *mockRepoForTest) GetUserName() (string, error) {
20	return "René Descartes", nil
21}
22
23// GetUserEmail returns the email address that the user has used to configure git.
24func (r *mockRepoForTest) GetUserEmail() (string, error) {
25	return "user@example.com", nil
26}
27
28// GetCoreEditor returns the name of the editor that the user has used to configure git.
29func (r *mockRepoForTest) GetCoreEditor() (string, error) {
30	return "vi", nil
31}
32
33// PushRefs push git refs to a remote
34func (r *mockRepoForTest) PushRefs(remote string, refPattern string) error {
35	return nil
36}
37
38func (r *mockRepoForTest) PullRefs(remote string, refPattern string, remoteRefPattern string) error {
39	return nil
40}
41
42func (r *mockRepoForTest) StoreData([]byte) (util.Hash, error) {
43	return "", nil
44}
45
46func (r *mockRepoForTest) StoreTree(mapping map[string]util.Hash) (util.Hash, error) {
47	return "", nil
48}
49
50func (r *mockRepoForTest) StoreCommit(treeHash util.Hash) (util.Hash, error) {
51	return "", nil
52}
53
54func (r *mockRepoForTest) StoreCommitWithParent(treeHash util.Hash, parent util.Hash) (util.Hash, error) {
55	return "", nil
56}
57
58func (r *mockRepoForTest) UpdateRef(ref string, hash util.Hash) error {
59	return nil
60}