INNER CODE UNIT · Go

TestDownloadStreamSymmetry

256dpi/lungo · bucket_test.go:43

func TestDownloadStreamSymmetry(t *testing.T) {
	a := methods(reflect.TypeOf(&DownloadStream{}), nil)
	b := methods(reflect.TypeOf(&gridfs.DownloadStream{}), gridfsReplacements, "SetReadDeadline")
	assert.Subset(t, a, b)
}

func TestBucketBasic(t *testing.T) {
	bucketTest(t, 0, func(t *testing.T, b *Bucket) {
		id, err := b.UploadFromStream(nil, "foo", strings.NewReader("Hello World!"))
		assert.NoError(t, err)
		assert.NotEmpty(t, id)

		var buf bytes.Buffer
		n, err := b.DownloadToStream(nil, id, &buf)
		assert.NoError(t, err)
		assert.Equal(t, int64(12), n)
		assert.Equal(t, "Hello World!", buf.String())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…