mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-07 13:38:15 -08:00
chore: static -> test_assets
This commit is contained in:
parent
b8fe630004
commit
9ea68f858d
8 changed files with 10 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ package engine_test
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -19,7 +20,7 @@ import (
|
||||||
|
|
||||||
func TestImportMaloja(t *testing.T) {
|
func TestImportMaloja(t *testing.T) {
|
||||||
|
|
||||||
src := "../static/maloja_import_test.json"
|
src := path.Join("..", "test_assets", "maloja_import_test.json")
|
||||||
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
||||||
dest := filepath.Join(destDir, "maloja_import_test.json")
|
dest := filepath.Join(destDir, "maloja_import_test.json")
|
||||||
|
|
||||||
|
|
@ -44,7 +45,7 @@ func TestImportMaloja(t *testing.T) {
|
||||||
|
|
||||||
func TestImportSpotify(t *testing.T) {
|
func TestImportSpotify(t *testing.T) {
|
||||||
|
|
||||||
src := "../static/Streaming_History_Audio_spotify_import_test.json"
|
src := path.Join("..", "test_assets", "Streaming_History_Audio_spotify_import_test.json")
|
||||||
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
||||||
dest := filepath.Join(destDir, "Streaming_History_Audio_spotify_import_test.json")
|
dest := filepath.Join(destDir, "Streaming_History_Audio_spotify_import_test.json")
|
||||||
|
|
||||||
|
|
@ -72,7 +73,7 @@ func TestImportSpotify(t *testing.T) {
|
||||||
|
|
||||||
func TestImportLastFM(t *testing.T) {
|
func TestImportLastFM(t *testing.T) {
|
||||||
|
|
||||||
src := "../static/recenttracks-shoko2-1749776100.json"
|
src := path.Join("..", "test_assets", "recenttracks-shoko2-1749776100.json")
|
||||||
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
||||||
dest := filepath.Join(destDir, "recenttracks-shoko2-1749776100.json")
|
dest := filepath.Join(destDir, "recenttracks-shoko2-1749776100.json")
|
||||||
|
|
||||||
|
|
@ -119,7 +120,7 @@ func TestImportLastFM(t *testing.T) {
|
||||||
|
|
||||||
func TestImportListenBrainz(t *testing.T) {
|
func TestImportListenBrainz(t *testing.T) {
|
||||||
|
|
||||||
src := "../static/listenbrainz_shoko1_1749780844.zip"
|
src := path.Join("..", "test_assets", "listenbrainz_shoko1_1749780844.zip")
|
||||||
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
destDir := filepath.Join(cfg.ConfigDir(), "import")
|
||||||
dest := filepath.Join(destDir, "listenbrainz_shoko1_1749780844.zip")
|
dest := filepath.Join(destDir, "listenbrainz_shoko1_1749780844.zip")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -664,9 +664,9 @@ func TestArtistReplaceImage(t *testing.T) {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
mpw := multipart.NewWriter(buf)
|
mpw := multipart.NewWriter(buf)
|
||||||
mpw.WriteField("artist_id", "1")
|
mpw.WriteField("artist_id", "1")
|
||||||
w, err := mpw.CreateFormFile("image", path.Join("..", "static", "yuu.jpg"))
|
w, err := mpw.CreateFormFile("image", path.Join("..", "test_assets", "yuu.jpg"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
f, err := os.Open(path.Join("..", "static", "yuu.jpg"))
|
f, err := os.Open(path.Join("..", "test_assets", "yuu.jpg"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
_, err = io.Copy(w, f)
|
_, err = io.Copy(w, f)
|
||||||
|
|
@ -702,9 +702,9 @@ func TestAlbumReplaceImage(t *testing.T) {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
mpw := multipart.NewWriter(buf)
|
mpw := multipart.NewWriter(buf)
|
||||||
mpw.WriteField("album_id", "1")
|
mpw.WriteField("album_id", "1")
|
||||||
w, err := mpw.CreateFormFile("image", path.Join("..", "static", "yuu.jpg"))
|
w, err := mpw.CreateFormFile("image", path.Join("..", "test_assets", "yuu.jpg"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
f, err := os.Open(path.Join("..", "static", "yuu.jpg"))
|
f, err := os.Open(path.Join("..", "test_assets", "yuu.jpg"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
_, err = io.Copy(w, f)
|
_, err = io.Copy(w, f)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import (
|
||||||
func TestImageLifecycle(t *testing.T) {
|
func TestImageLifecycle(t *testing.T) {
|
||||||
|
|
||||||
// serve yuu.jpg as test image
|
// serve yuu.jpg as test image
|
||||||
imageBytes, err := os.ReadFile(filepath.Join("static", "yuu.jpg"))
|
imageBytes, err := os.ReadFile(filepath.Join("test_assets", "yuu.jpg"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "image/jpeg")
|
w.Header().Set("Content-Type", "image/jpeg")
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Add table
Add a link
Reference in a new issue