MCPcopy Create free account
hub / github.com/go-git/go-git / TestCommitSignBadKey

Method TestCommitSignBadKey

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

Source from the content-addressed store, hash-verified

375}
376
377func (s *WorktreeSuite) TestCommitSignBadKey(c *C) {
378 fs := memfs.New()
379 storage := memory.NewStorage()
380
381 r, err := Init(storage, fs)
382 c.Assert(err, IsNil)
383
384 w, err := r.Worktree()
385 c.Assert(err, IsNil)
386
387 util.WriteFile(fs, "foo", []byte("foo"), 0644)
388
389 _, err = w.Add("foo")
390 c.Assert(err, IsNil)
391
392 key := commitSignKey(c, false)
393 _, err = w.Commit("foo\n", &CommitOptions{Author: defaultSignature(), SignKey: key})
394 c.Assert(err, Equals, errors.InvalidArgumentError("signing key is encrypted"))
395}
396
397func (s *WorktreeSuite) TestCommitTreeSort(c *C) {
398 fs, clean := s.TemporalFilesystem()

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