mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-27 19:01:01 +00:00
[chore] remove funky duplicate attachment in testrig (#1379)
* [chore] remove funky duplicate attachment in testrig * whoops
This commit is contained in:
parent
e9747247d5
commit
36f62d6e60
4 changed files with 8 additions and 57 deletions
|
@ -35,7 +35,7 @@ type MediaCleanupTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *MediaCleanupTestSuite) TestMediaCleanup() {
|
||||
testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_2"]
|
||||
testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"]
|
||||
suite.True(*testAttachment.Cached)
|
||||
|
||||
// set up the request
|
||||
|
@ -60,7 +60,7 @@ func (suite *MediaCleanupTestSuite) TestMediaCleanup() {
|
|||
}
|
||||
|
||||
func (suite *MediaCleanupTestSuite) TestMediaCleanupNoArg() {
|
||||
testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_2"]
|
||||
testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"]
|
||||
suite.True(*testAttachment.Cached)
|
||||
println("TIME: ", testAttachment.CreatedAt.String())
|
||||
|
||||
|
@ -85,7 +85,7 @@ func (suite *MediaCleanupTestSuite) TestMediaCleanupNoArg() {
|
|||
}
|
||||
|
||||
func (suite *MediaCleanupTestSuite) TestMediaCleanupNotOldEnough() {
|
||||
testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_2"]
|
||||
testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"]
|
||||
suite.True(*testAttachment.Cached)
|
||||
|
||||
// set up the request
|
||||
|
|
|
@ -41,7 +41,7 @@ func (suite *MediaTestSuite) TestGetAttachmentByID() {
|
|||
func (suite *MediaTestSuite) TestGetOlder() {
|
||||
attachments, err := suite.db.GetRemoteOlderThan(context.Background(), time.Now(), 20)
|
||||
suite.NoError(err)
|
||||
suite.Len(attachments, 3)
|
||||
suite.Len(attachments, 2)
|
||||
}
|
||||
|
||||
func (suite *MediaTestSuite) TestGetAvisAndHeaders() {
|
||||
|
|
|
@ -43,7 +43,7 @@ func (suite *PruneRemoteTestSuite) TestPruneRemote() {
|
|||
|
||||
totalPruned, err := suite.manager.PruneAllRemote(context.Background(), 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(3, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
|
||||
prunedAttachment, err := suite.db.GetAttachmentByID(context.Background(), testStatusAttachment.ID)
|
||||
suite.NoError(err)
|
||||
|
@ -57,7 +57,7 @@ func (suite *PruneRemoteTestSuite) TestPruneRemote() {
|
|||
func (suite *PruneRemoteTestSuite) TestPruneRemoteTwice() {
|
||||
totalPruned, err := suite.manager.PruneAllRemote(context.Background(), 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(3, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
|
||||
// final prune should prune nothing, since the first prune already happened
|
||||
totalPrunedAgain, err := suite.manager.PruneAllRemote(context.Background(), 1)
|
||||
|
@ -72,7 +72,7 @@ func (suite *PruneRemoteTestSuite) TestPruneAndRecache() {
|
|||
|
||||
totalPruned, err := suite.manager.PruneAllRemote(ctx, 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(3, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
|
||||
// media should no longer be stored
|
||||
_, err = suite.storage.Get(ctx, testStatusAttachment.File.Path)
|
||||
|
@ -135,7 +135,7 @@ func (suite *PruneRemoteTestSuite) TestPruneOneNonExistent() {
|
|||
// Now attempt to prune remote for item with db entry no file
|
||||
totalPruned, err := suite.manager.PruneAllRemote(ctx, 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(3, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
}
|
||||
|
||||
func TestPruneRemoteTestSuite(t *testing.T) {
|
||||
|
|
|
@ -1028,55 +1028,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
|||
Header: FalseBool(),
|
||||
Cached: TrueBool(),
|
||||
},
|
||||
"remote_account_1_status_1_attachment_2": {
|
||||
ID: "01FVW7RXPQ8YJHTEXYPE7Q8ZY1",
|
||||
StatusID: "01FVW7JHQFSFK166WWKR8CBA6M",
|
||||
URL: "http://localhost:8080/fileserver/01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/original/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",
|
||||
RemoteURL: "http://fossbros-anonymous.io/attachments/original/13bbc3f8-2b5e-46ea-9531-40b4974d9912.jpg",
|
||||
CreatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"),
|
||||
UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
Width: 472,
|
||||
Height: 291,
|
||||
Size: 137352,
|
||||
Aspect: 1.6219931271477663,
|
||||
},
|
||||
Small: gtsmodel.Small{
|
||||
Width: 472,
|
||||
Height: 291,
|
||||
Size: 137352,
|
||||
Aspect: 1.6219931271477663,
|
||||
},
|
||||
Focus: gtsmodel.Focus{
|
||||
X: 0,
|
||||
Y: 0,
|
||||
},
|
||||
},
|
||||
AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
|
||||
Description: "tweet from thoughts of dog: i drank. all the water. in my bowl. earlier. but just now. i returned. to the same bowl. and it was. full again.. the bowl. is haunted",
|
||||
ScheduledStatusID: "",
|
||||
Blurhash: "LARysgM_IU_3~pD%M_Rj_39FIAt6",
|
||||
Processing: 2,
|
||||
File: gtsmodel.File{
|
||||
Path: "01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/original/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",
|
||||
ContentType: "image/jpeg",
|
||||
FileSize: 19310,
|
||||
UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"),
|
||||
},
|
||||
Thumbnail: gtsmodel.Thumbnail{
|
||||
Path: "01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/small/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",
|
||||
ContentType: "image/jpeg",
|
||||
FileSize: 20395,
|
||||
UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"),
|
||||
URL: "http://localhost:8080/fileserver/01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/small/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",
|
||||
RemoteURL: "http://fossbros-anonymous.io/attachments/small/a499f55b-2d1e-4acd-98d2-1ac2ba6d79b9.jpg",
|
||||
},
|
||||
Avatar: FalseBool(),
|
||||
Header: FalseBool(),
|
||||
Cached: TrueBool(),
|
||||
},
|
||||
"remote_account_3_header": {
|
||||
ID: "01PFPMWK2FF0D9WMHEJHR07C3R",
|
||||
StatusID: "",
|
||||
|
|
Loading…
Reference in a new issue