diff options
Diffstat (limited to 'repository/mock_repo.go')
-rw-r--r-- | repository/mock_repo.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/repository/mock_repo.go b/repository/mock_repo.go index 97a4504f..14f5e7b5 100644 --- a/repository/mock_repo.go +++ b/repository/mock_repo.go @@ -3,6 +3,7 @@ package repository import ( "crypto/sha1" "fmt" + "strconv" "strings" "github.com/MichaelMure/git-bug/util/git" @@ -75,6 +76,26 @@ func (r *mockRepoForTest) ReadConfigs(keyPrefix string) (map[string]string, erro return result, nil } +func (r *mockRepoForTest) ReadConfigBool(key string) (bool, error) { + // unlike git, the mock can only store one value for the same key + val, ok := r.config[key] + if !ok { + return false, ErrNoConfigEntry + } + + return strconv.ParseBool(val) +} + +func (r *mockRepoForTest) ReadConfigString(key string) (string, error) { + // unlike git, the mock can only store one value for the same key + val, ok := r.config[key] + if !ok { + return "", ErrNoConfigEntry + } + + return val, nil +} + func (r *mockRepoForTest) RmConfigs(keyPrefix string) error { for key := range r.config { if strings.HasPrefix(key, keyPrefix) { |