diff options
author | 2022-07-22 12:48:19 +0200 | |
---|---|---|
committer | 2022-07-22 12:48:19 +0200 | |
commit | 73b8839c5d1b481d1aa1330cd8c206a9f2213333 (patch) | |
tree | 877525e40448effbc37d31fdc4f6cbef23263ee8 /internal/api/client/media/mediaupdate_test.go | |
parent | [bugfix] update go-cache library to fix critical bug during cache sweep sched... (diff) | |
download | gotosocial-73b8839c5d1b481d1aa1330cd8c206a9f2213333.tar.xz |
[bugfix] Make `/api/v2/media` more compatible with masto API (#724)
* update docs
* make api version into a path param
* update tests
* workaround to unset URL if using v2 of api
* make some fields into pointers
Diffstat (limited to 'internal/api/client/media/mediaupdate_test.go')
-rw-r--r-- | internal/api/client/media/mediaupdate_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/api/client/media/mediaupdate_test.go b/internal/api/client/media/mediaupdate_test.go index 8081a5c15..607f4c31c 100644 --- a/internal/api/client/media/mediaupdate_test.go +++ b/internal/api/client/media/mediaupdate_test.go @@ -145,7 +145,7 @@ func (suite *MediaUpdateTestSuite) TestUpdateImage() { if err != nil { panic(err) } - ctx.Request = httptest.NewRequest(http.MethodPut, fmt.Sprintf("http://localhost:8080/%s/%s", mediamodule.BasePathV1, toUpdate.ID), bytes.NewReader(buf.Bytes())) // the endpoint we're hitting + ctx.Request = httptest.NewRequest(http.MethodPut, fmt.Sprintf("http://localhost:8080/api/v1/media/%s", toUpdate.ID), bytes.NewReader(buf.Bytes())) // the endpoint we're hitting ctx.Request.Header.Set("Content-Type", w.FormDataContentType()) ctx.Request.Header.Set("accept", "application/json") ctx.Params = gin.Params{ @@ -172,7 +172,7 @@ func (suite *MediaUpdateTestSuite) TestUpdateImage() { suite.NoError(err) // the reply should contain the updated fields - suite.Equal("new description!", attachmentReply.Description) + suite.Equal("new description!", *attachmentReply.Description) suite.EqualValues("gif", attachmentReply.Type) suite.EqualValues(model.MediaMeta{ Original: model.MediaDimensions{Width: 800, Height: 450, FrameRate: "", Duration: 0, Bitrate: 0, Size: "800x450", Aspect: 1.7777778}, @@ -181,7 +181,7 @@ func (suite *MediaUpdateTestSuite) TestUpdateImage() { }, attachmentReply.Meta) suite.Equal(toUpdate.Blurhash, attachmentReply.Blurhash) suite.Equal(toUpdate.ID, attachmentReply.ID) - suite.Equal(toUpdate.URL, attachmentReply.URL) + suite.Equal(toUpdate.URL, *attachmentReply.URL) suite.NotEmpty(toUpdate.Thumbnail.URL, attachmentReply.PreviewURL) } @@ -210,7 +210,7 @@ func (suite *MediaUpdateTestSuite) TestUpdateImageShortDescription() { if err != nil { panic(err) } - ctx.Request = httptest.NewRequest(http.MethodPut, fmt.Sprintf("http://localhost:8080/%s/%s", mediamodule.BasePathV1, toUpdate.ID), bytes.NewReader(buf.Bytes())) // the endpoint we're hitting + ctx.Request = httptest.NewRequest(http.MethodPut, fmt.Sprintf("http://localhost:8080/api/v1/media/%s", toUpdate.ID), bytes.NewReader(buf.Bytes())) // the endpoint we're hitting ctx.Request.Header.Set("Content-Type", w.FormDataContentType()) ctx.Request.Header.Set("accept", "application/json") ctx.Params = gin.Params{ |