summaryrefslogtreecommitdiffstats
path: root/models/attachment_test.go
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2019-12-11 01:01:52 +0100
committerzeripath <art27@cantab.net>2019-12-11 00:01:52 +0000
commitc3d31e55346329a221cc0ae37d89d1fba11ea737 (patch)
tree61914ec27d02be2351a1951ada1526e9beb455db /models/attachment_test.go
parent50da9f7daed4fe3e8f0c76f23eeb987e97de4962 (diff)
downloadgitea-c3d31e55346329a221cc0ae37d89d1fba11ea737.tar.gz
gitea-c3d31e55346329a221cc0ae37d89d1fba11ea737.zip
refactor(models/attachement): use getAttachmentsByUUIDs (#9317)
Diffstat (limited to 'models/attachment_test.go')
-rw-r--r--models/attachment_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/models/attachment_test.go b/models/attachment_test.go
index 3984425e48..f38a5beeee 100644
--- a/models/attachment_test.go
+++ b/models/attachment_test.go
@@ -116,3 +116,15 @@ func TestUpdateAttachment(t *testing.T) {
AssertExistsAndLoadBean(t, &Attachment{Name: "new_name"})
}
+
+func TestGetAttachmentsByUUIDs(t *testing.T) {
+ assert.NoError(t, PrepareTestDatabase())
+
+ attachList, err := GetAttachmentsByUUIDs([]string{"a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11", "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17", "not-existing-uuid"})
+ assert.NoError(t, err)
+ assert.Equal(t, 2, len(attachList))
+ assert.Equal(t, "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11", attachList[0].UUID)
+ assert.Equal(t, "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17", attachList[1].UUID)
+ assert.Equal(t, int64(1), attachList[0].IssueID)
+ assert.Equal(t, int64(5), attachList[1].IssueID)
+}