MCPcopy Create free account
hub / github.com/gogs/gogs / lfsGetObjectByOID

Function lfsGetObjectByOID

internal/database/lfs_test.go:64–79  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, s *LFSStore)

Source from the content-addressed store, hash-verified

62}
63
64func lfsGetObjectByOID(t *testing.T, ctx context.Context, s *LFSStore) {
65 // Create a LFS object
66 repoID := int64(1)
67 oid := lfsutil.OID("ef797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f")
68 err := s.CreateObject(ctx, repoID, oid, 12, lfsutil.StorageLocal)
69 require.NoError(t, err)
70
71 // We should be able to get it back
72 _, err = s.GetObjectByOID(ctx, repoID, oid)
73 require.NoError(t, err)
74
75 // Try to get a non-existent object
76 _, err = s.GetObjectByOID(ctx, repoID, "bad_oid")
77 expErr := ErrLFSObjectNotExist{args: errutil.Args{"repoID": repoID, "oid": lfsutil.OID("bad_oid")}}
78 assert.Equal(t, expErr, err)
79}
80
81func lfsGetObjectsByOIDs(t *testing.T, ctx context.Context, s *LFSStore) {
82 // Create two LFS objects

Callers

nothing calls this directly

Calls 3

OIDTypeAlias · 0.92
CreateObjectMethod · 0.80
GetObjectByOIDMethod · 0.80

Tested by

no test coverage detected