mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-09 18:07:29 -06:00
work on emojis
This commit is contained in:
parent
de9718c566
commit
32629a378d
31 changed files with 605 additions and 67 deletions
|
|
@ -36,9 +36,9 @@ func NewTestStorage() storage.Storage {
|
|||
|
||||
// StandardStorageSetup populates the storage with standard test entries from the given directory.
|
||||
func StandardStorageSetup(s storage.Storage, relativePath string) {
|
||||
stored := NewTestStored()
|
||||
storedA := NewTestStoredAttachments()
|
||||
a := NewTestAttachments()
|
||||
for k, paths := range stored {
|
||||
for k, paths := range storedA {
|
||||
attachmentInfo, ok := a[k]
|
||||
if !ok {
|
||||
panic(fmt.Errorf("key %s not found in test attachments", k))
|
||||
|
|
@ -62,6 +62,33 @@ func StandardStorageSetup(s storage.Storage, relativePath string) {
|
|||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
storedE := NewTestStoredEmoji()
|
||||
e := NewTestEmojis()
|
||||
for k, paths := range storedE {
|
||||
emojiInfo, ok := e[k]
|
||||
if !ok {
|
||||
panic(fmt.Errorf("key %s not found in test emojis", k))
|
||||
}
|
||||
filenameOriginal := paths.original
|
||||
filenameStatic := paths.static
|
||||
pathOriginal := emojiInfo.ImagePath
|
||||
pathStatic := emojiInfo.ImageStaticPath
|
||||
bOriginal, err := os.ReadFile(fmt.Sprintf("%s/%s", relativePath, filenameOriginal))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := s.StoreFileAt(pathOriginal, bOriginal); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bStatic, err := os.ReadFile(fmt.Sprintf("%s/%s", relativePath, filenameStatic))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := s.StoreFileAt(pathStatic, bStatic); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// StandardStorageTeardown deletes everything in storage so that it's clean for the next test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue