MCPcopy
hub / github.com/rclone/rclone / TestNewObjectWithLeadingSlash

Function TestNewObjectWithLeadingSlash

backend/http/http_internal_test.go:211–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

209}
210
211func TestNewObjectWithLeadingSlash(t *testing.T) {
212 f := prepare(t)
213
214 o, err := f.NewObject(context.Background(), "/four/under four.txt")
215 require.NoError(t, err)
216
217 assert.Equal(t, "/four/under four.txt", o.Remote())
218 assert.Equal(t, int64(8+lineEndSize), o.Size())
219 _, ok := o.(*Object)
220 assert.True(t, ok)
221
222 // Test the time is correct on the object
223
224 tObj := o.ModTime(context.Background())
225
226 fi, err := os.Stat(filepath.Join(filesPath, "four", "under four.txt"))
227 require.NoError(t, err)
228 tFile := fi.ModTime()
229
230 fstest.AssertTimeEqualWithPrecision(t, o.Remote(), tFile, tObj, time.Second)
231
232 // check object not found
233 o, err = f.NewObject(context.Background(), "/not found.txt")
234 assert.Nil(t, o)
235 assert.Equal(t, fs.ErrorObjectNotFound, err)
236}
237
238func TestNewObjectWithMetadata(t *testing.T) {
239 f := prepare(t)

Callers

nothing calls this directly

Calls 10

RemoteMethod · 0.95
SizeMethod · 0.95
ModTimeMethod · 0.95
JoinMethod · 0.80
prepareFunction · 0.70
NewObjectMethod · 0.65
StatMethod · 0.65
ModTimeMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…