MCPcopy Index your code
hub / github.com/go-git/go-git / TestCommitSignBadKey

Method TestCommitSignBadKey

worktree_commit_test.go:497–515  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

495}
496
497func (s *WorktreeSuite) TestCommitSignBadKey(c *C) {
498 fs := memfs.New()
499 storage := memory.NewStorage()
500
501 r, err := Init(storage, fs)
502 c.Assert(err, IsNil)
503
504 w, err := r.Worktree()
505 c.Assert(err, IsNil)
506
507 util.WriteFile(fs, "foo", []byte("foo"), 0644)
508
509 _, err = w.Add("foo")
510 c.Assert(err, IsNil)
511
512 key := commitSignKey(c, false)
513 _, err = w.Commit("foo\n", &CommitOptions{Author: defaultSignature(), SignKey: key})
514 c.Assert(err, Equals, errors.InvalidArgumentError("signing key is encrypted"))
515}
516
517func (s *WorktreeSuite) TestCommitTreeSort(c *C) {
518 fs := s.TemporalFilesystem(c)

Callers

nothing calls this directly

Calls 7

NewStorageFunction · 0.92
InitFunction · 0.85
commitSignKeyFunction · 0.85
defaultSignatureFunction · 0.85
WorktreeMethod · 0.80
CommitMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected