From ac6ed3d939fe9dad81aadbd04541e905c625ca82 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 15 Aug 2022 12:35:05 +0200 Subject: [chore] Update bun / sqlite versions; update gtsmodels (#754) * upstep bun and sqlite versions * allow specific columns to be updated in the db * only update necessary columns for user * bit tidier * only update necessary fields of media_attachment * only update relevant instance fields * update tests * update only specific account columns * use bool pointers on gtsmodels includes attachment, status, account, user * update columns more selectively * test all default fields on new account insert * updating remaining bools on gtsmodels * initialize pointer fields when extracting AP emoji * copy bools properly * add copyBoolPtr convenience function + test it * initialize false bool ptrs a bit more neatly --- internal/processing/media/getfile_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'internal/processing/media/getfile_test.go') diff --git a/internal/processing/media/getfile_test.go b/internal/processing/media/getfile_test.go index 7c6525abe..6ba06426f 100644 --- a/internal/processing/media/getfile_test.go +++ b/internal/processing/media/getfile_test.go @@ -28,6 +28,7 @@ import ( "github.com/stretchr/testify/suite" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/media" + "github.com/superseriousbusiness/gotosocial/testrig" ) type GetFileTestSuite struct { @@ -67,8 +68,8 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncached() { // uncache the file from local testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"] - testAttachment.Cached = false - err := suite.db.UpdateByPrimaryKey(ctx, testAttachment) + testAttachment.Cached = testrig.FalseBool() + err := suite.db.UpdateByPrimaryKey(ctx, testAttachment, "cached") suite.NoError(err) err = suite.storage.Delete(ctx, testAttachment.File.Path) suite.NoError(err) @@ -103,7 +104,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncached() { // the attachment should be updated in the database dbAttachment, err := suite.db.GetAttachmentByID(ctx, testAttachment.ID) suite.NoError(err) - suite.True(dbAttachment.Cached) + suite.True(*dbAttachment.Cached) // the file should be back in storage at the same path as before refreshedBytes, err := suite.storage.Get(ctx, testAttachment.File.Path) @@ -116,8 +117,8 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncachedInterrupted() { // uncache the file from local testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"] - testAttachment.Cached = false - err := suite.db.UpdateByPrimaryKey(ctx, testAttachment) + testAttachment.Cached = testrig.FalseBool() + err := suite.db.UpdateByPrimaryKey(ctx, testAttachment, "cached") suite.NoError(err) err = suite.storage.Delete(ctx, testAttachment.File.Path) suite.NoError(err) @@ -153,7 +154,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncachedInterrupted() { // the attachment should still be updated in the database even though the caller hung up dbAttachment, err := suite.db.GetAttachmentByID(ctx, testAttachment.ID) suite.NoError(err) - suite.True(dbAttachment.Cached) + suite.True(*dbAttachment.Cached) // the file should be back in storage at the same path as before refreshedBytes, err := suite.storage.Get(ctx, testAttachment.File.Path) @@ -170,8 +171,8 @@ func (suite *GetFileTestSuite) TestGetRemoteFileThumbnailUncached() { suite.NoError(err) // uncache the file from local - testAttachment.Cached = false - err = suite.db.UpdateByPrimaryKey(ctx, testAttachment) + testAttachment.Cached = testrig.FalseBool() + err = suite.db.UpdateByPrimaryKey(ctx, testAttachment, "cached") suite.NoError(err) err = suite.storage.Delete(ctx, testAttachment.File.Path) suite.NoError(err) -- cgit v1.2.3