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

Function lfsCreateObject

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

Source from the content-addressed store, hash-verified

45}
46
47func lfsCreateObject(t *testing.T, ctx context.Context, s *LFSStore) {
48 // Create first LFS object
49 repoID := int64(1)
50 oid := lfsutil.OID("ef797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f")
51 err := s.CreateObject(ctx, repoID, oid, 12, lfsutil.StorageLocal)
52 require.NoError(t, err)
53
54 // Get it back and check the CreatedAt field
55 object, err := s.GetObjectByOID(ctx, repoID, oid)
56 require.NoError(t, err)
57 assert.Equal(t, s.db.NowFunc().Format(time.RFC3339), object.CreatedAt.UTC().Format(time.RFC3339))
58
59 // Try to create second LFS object with same oid should fail
60 err = s.CreateObject(ctx, repoID, oid, 12, lfsutil.StorageLocal)
61 assert.Error(t, err)
62}
63
64func lfsGetObjectByOID(t *testing.T, ctx context.Context, s *LFSStore) {
65 // Create a LFS object

Callers

nothing calls this directly

Calls 4

OIDTypeAlias · 0.92
CreateObjectMethod · 0.80
GetObjectByOIDMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected