From 8c9a1712fbd83df9e450c7f19d913dcc4feb9c2e Mon Sep 17 00:00:00 2001 From: David Christofas Date: Thu, 11 Feb 2021 16:43:01 +0100 Subject: [PATCH] delete unnecessary protobuf tests --- thumbnails/pkg/proto/v0/thumbnails.pb_test.go | 99 ------------------- 1 file changed, 99 deletions(-) delete mode 100644 thumbnails/pkg/proto/v0/thumbnails.pb_test.go diff --git a/thumbnails/pkg/proto/v0/thumbnails.pb_test.go b/thumbnails/pkg/proto/v0/thumbnails.pb_test.go deleted file mode 100644 index 84806b831..000000000 --- a/thumbnails/pkg/proto/v0/thumbnails.pb_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package proto_test - -import ( - "testing" - - "github.com/owncloud/ocis/thumbnails/pkg/proto/v0" - "github.com/stretchr/testify/assert" -) - -type TestRequest struct { - testDataName string - filepath string - filetype proto.GetRequest_FileType - etag string - width int32 - height int32 - authorization string - expected string -} - -type TestResponse struct { - testDataName string - img []byte - mimetype string - expected string -} - -func TestRequestString(t *testing.T) { - - var tests = []TestRequest{ - { - "ASCII", - "Foo.jpg", - proto.GetRequest_JPG, - "33a64df551425fcc55e4d42a148795d9f25f89d4", - 24, - 24, - "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", - `filepath:"Foo.jpg" filetype:JPG etag:"33a64df551425fcc55e4d42a148795d9f25f89d4" width:24 height:24 authorization:"Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK" username:"user1"`, - }, - { - "UTF", - "मिलन.jpg", - proto.GetRequest_JPG, - "33a64df551425fcc55e4d42a148795d9f25f89d4", - 24, - 24, - "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", - `filepath:"मिलन.jpg" filetype:JPG etag:"33a64df551425fcc55e4d42a148795d9f25f89d4" width:24 height:24 authorization:"Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK" username:"user1"`, - }, - { - "PNG", - "Foo.png", - proto.GetRequest_PNG, - "33a64df551425fcc55e4d42a148795d9f25f89d4", - 24, - 24, - "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", - `filepath:"Foo.png" etag:"33a64df551425fcc55e4d42a148795d9f25f89d4" width:24 height:24 authorization:"Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK" username:"user1"`, - }, - } - - for _, testCase := range tests { - t.Run(testCase.testDataName, func(t *testing.T) { - req := proto.GetRequest{ - Filepath: testCase.filepath, - Filetype: testCase.filetype, - Etag: testCase.etag, - Height: testCase.height, - Width: testCase.width, - Authorization: testCase.authorization, - Username: "user1", - } - assert.Equal(t, testCase.expected, req.String()) - }) - } -} - -func TestResponseString(t *testing.T) { - var tests = []TestResponse{ - { - "ASCII", - []byte("image data"), - "image/png", - `thumbnail:"image data" mimetype:"image/png"`, - }, - } - - for _, testCase := range tests { - t.Run(testCase.testDataName, func(t *testing.T) { - response := proto.GetResponse{ - Thumbnail: testCase.img, - Mimetype: testCase.mimetype, - } - - assert.Equal(t, testCase.expected, response.String()) - }) - } -}