diff --git a/api/graphql/models/media_test.go b/api/graphql/models/media_test.go index 65805069..d68f3a5d 100644 --- a/api/graphql/models/media_test.go +++ b/api/graphql/models/media_test.go @@ -5,6 +5,8 @@ import ( "testing" "github.com/photoview/photoview/api/graphql/models" + "github.com/photoview/photoview/api/test_utils" + "github.com/photoview/photoview/api/utils" "github.com/stretchr/testify/assert" ) @@ -53,6 +55,9 @@ func TestMediaURLCachePath(t *testing.T) { } func TestMediaURLGetURL(t *testing.T) { + done := test_utils.SetEnv(string(utils.EnvAPIEndpoint), "") + defer done() + photo := models.MediaURL{ MediaName: "photo.jpg", ContentType: mimeJpeg, diff --git a/api/scanner/media_encoding/executable_worker/executable_worker_test.go b/api/scanner/media_encoding/executable_worker/executable_worker_test.go index da4f073a..00ae77ff 100644 --- a/api/scanner/media_encoding/executable_worker/executable_worker_test.go +++ b/api/scanner/media_encoding/executable_worker/executable_worker_test.go @@ -3,10 +3,10 @@ package executable_worker import ( "testing" - "github.com/photoview/photoview/api/test_utils/test_env" + "github.com/photoview/photoview/api/test_utils" ) -const testdataBinPath = "./testdata/bin" +const testdataBinPath = "./test_data/mock_bin" func TestInitFfprobePath(t *testing.T) { t.Run("PathFail", func(t *testing.T) { @@ -17,10 +17,10 @@ func TestInitFfprobePath(t *testing.T) { }) t.Run("VersionFail", func(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() - doneEnv := test_env.SetEnv("FAIL_WITH", "expect failure") + doneEnv := test_utils.SetEnv("FAIL_WITH", "expect failure") defer doneEnv() err := SetFfprobePath() @@ -30,7 +30,7 @@ func TestInitFfprobePath(t *testing.T) { }) t.Run("Succeed", func(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() err := SetFfprobePath() diff --git a/api/scanner/media_encoding/executable_worker/ffmpeg_cli_test.go b/api/scanner/media_encoding/executable_worker/ffmpeg_cli_test.go index c7e71803..86fe4c76 100644 --- a/api/scanner/media_encoding/executable_worker/ffmpeg_cli_test.go +++ b/api/scanner/media_encoding/executable_worker/ffmpeg_cli_test.go @@ -5,13 +5,13 @@ import ( "regexp" "testing" - "github.com/photoview/photoview/api/test_utils/test_env" + "github.com/photoview/photoview/api/test_utils" "github.com/photoview/photoview/api/utils" "gopkg.in/vansante/go-ffprobe.v2" ) func TestFfmpegNotExist(t *testing.T) { - done := test_env.SetPathWithCurrent() + done := test_utils.SetPathWithCurrent() defer done() Ffmpeg = newFfmpegCli() @@ -34,10 +34,10 @@ func TestFfmpegNotExist(t *testing.T) { } func TestFfmpegVersionFail(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() - doneEnv := test_env.SetEnv("FAIL_WITH", "expect failure") + doneEnv := test_utils.SetEnv("FAIL_WITH", "expect failure") defer doneEnv() Ffmpeg = newFfmpegCli() @@ -60,10 +60,10 @@ func TestFfmpegVersionFail(t *testing.T) { } func TestFfmpegIgnore(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() - doneEnv := test_env.SetEnv("PHOTOVIEW_DISABLE_VIDEO_ENCODING", "true") + doneEnv := test_utils.SetEnv("PHOTOVIEW_DISABLE_VIDEO_ENCODING", "true") defer doneEnv() Ffmpeg = newFfmpegCli() @@ -86,7 +86,7 @@ func TestFfmpegIgnore(t *testing.T) { } func TestFfmpeg(t *testing.T) { - done := test_env.SetPathWithCurrent(testdataBinPath) + done := test_utils.SetPathWithCurrent(testdataBinPath) defer done() Ffmpeg = newFfmpegCli() @@ -96,14 +96,14 @@ func TestFfmpeg(t *testing.T) { } t.Run("EncodeMp4Failed", func(t *testing.T) { - doneEnv := test_env.SetEnv("FAIL_WITH", "expect failure") + doneEnv := test_utils.SetEnv("FAIL_WITH", "expect failure") defer doneEnv() err := Ffmpeg.EncodeMp4("input", "output") if err == nil { t.Fatalf("Ffmpeg.EncodeMp4(...) = nil, should be an error.") } - if got, want := err.Error(), `^encoding video with ".*/testdata/bin/ffmpeg" \[-i input -vcodec h264 .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { + if got, want := err.Error(), `^encoding video with ".*/test_data/mock_bin/ffmpeg" \[-i input -vcodec h264 .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { t.Errorf("Ffmpeg.EncodeMp4(...) = %q, should be as reg pattern %q", got, want) } }) @@ -121,14 +121,14 @@ func TestFfmpeg(t *testing.T) { }, } t.Run("EncodeVideoThumbnailMp4Failed", func(t *testing.T) { - doneEnv := test_env.SetEnv("FAIL_WITH", "expect failure") + doneEnv := test_utils.SetEnv("FAIL_WITH", "expect failure") defer doneEnv() err := Ffmpeg.EncodeVideoThumbnail("input", "output", probeData) if err == nil { t.Fatalf("Ffmpeg.EncodeVideoThumbnail(...) = nil, should be an error.") } - if got, want := err.Error(), `^encoding video thumbnail with ".*/testdata/bin/ffmpeg" \[-ss 2 -i input .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { + if got, want := err.Error(), `^encoding video thumbnail with ".*/test_data/mock_bin/ffmpeg" \[-ss 2 -i input .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { t.Errorf("Ffmpeg.EncodeVideoThumbnail(...) = %q, should be as reg pattern %q", got, want) } }) @@ -142,43 +142,43 @@ func TestFfmpeg(t *testing.T) { } func TestFfmpegWithHWAcc(t *testing.T) { - doneCodec := test_env.SetEnv(utils.EnvVideoHardwareAcceleration.GetName(), "qsv") + doneCodec := test_utils.SetEnv(utils.EnvVideoHardwareAcceleration.GetName(), "qsv") defer doneCodec() - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() Ffmpeg = newFfmpegCli() - doneEnv := test_env.SetEnv("FAIL_WITH", "expect failure") + doneEnv := test_utils.SetEnv("FAIL_WITH", "expect failure") defer doneEnv() err := Ffmpeg.EncodeMp4("input", "output") if err == nil { t.Fatalf("Ffmpeg.EncodeMp4(...) = nil, should be an error.") } - if got, want := err.Error(), `^encoding video with ".*/testdata/bin/ffmpeg" \[-i input -vcodec h264_qsv .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { + if got, want := err.Error(), `^encoding video with ".*/test_data/mock_bin/ffmpeg" \[-i input -vcodec h264_qsv .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { t.Errorf("Ffmpeg.EncodeMp4(...) = %q, should be as reg pattern %q", got, want) } } func TestFfmpegWithCustomCOdec(t *testing.T) { - doneCodec := test_env.SetEnv(utils.EnvVideoHardwareAcceleration.GetName(), "_custom") + doneCodec := test_utils.SetEnv(utils.EnvVideoHardwareAcceleration.GetName(), "_custom") defer doneCodec() - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() Ffmpeg = newFfmpegCli() - doneEnv := test_env.SetEnv("FAIL_WITH", "expect failure") + doneEnv := test_utils.SetEnv("FAIL_WITH", "expect failure") defer doneEnv() err := Ffmpeg.EncodeMp4("input", "output") if err == nil { t.Fatalf("Ffmpeg.EncodeMp4(...) = nil, should be an error.") } - if got, want := err.Error(), `^encoding video with ".*/testdata/bin/ffmpeg" \[-i input -vcodec custom .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { + if got, want := err.Error(), `^encoding video with ".*/test_data/mock_bin/ffmpeg" \[-i input -vcodec custom .* output\] error: .*$`; !regexp.MustCompile(want).MatchString(got) { t.Errorf("Ffmpeg.EncodeMp4(...) = %q, should be as reg pattern %q", got, want) } } diff --git a/api/scanner/media_encoding/executable_worker/magick_cli_test.go b/api/scanner/media_encoding/executable_worker/magick_cli_test.go index a5746b90..1b9fed20 100644 --- a/api/scanner/media_encoding/executable_worker/magick_cli_test.go +++ b/api/scanner/media_encoding/executable_worker/magick_cli_test.go @@ -5,11 +5,11 @@ import ( "regexp" "testing" - "github.com/photoview/photoview/api/test_utils/test_env" + "github.com/photoview/photoview/api/test_utils" ) func TestMagickCliNotExist(t *testing.T) { - done := test_env.SetPathWithCurrent() + done := test_utils.SetPathWithCurrent() defer done() Magick = newMagickCli() @@ -28,10 +28,10 @@ func TestMagickCliNotExist(t *testing.T) { } func TestMagickCliIgnore(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() - doneDisableRaw := test_env.SetEnv("PHOTOVIEW_DISABLE_RAW_PROCESSING", "true") + doneDisableRaw := test_utils.SetEnv("PHOTOVIEW_DISABLE_RAW_PROCESSING", "true") defer doneDisableRaw() Magick = newMagickCli() @@ -50,10 +50,10 @@ func TestMagickCliIgnore(t *testing.T) { } func TestMagickCliVersionFail(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() - done := test_env.SetEnv("FAIL_WITH", "failure") + done := test_utils.SetEnv("FAIL_WITH", "failure") defer done() Magick = newMagickCli() @@ -72,7 +72,7 @@ func TestMagickCliVersionFail(t *testing.T) { } func TestMagickCliFail(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() Magick = newMagickCli() @@ -81,7 +81,7 @@ func TestMagickCliFail(t *testing.T) { t.Fatal("MagickCli should be installed") } - done := test_env.SetEnv("FAIL_WITH", "failure") + done := test_utils.SetEnv("FAIL_WITH", "failure") defer done() err := Magick.EncodeJpeg("input", "output", 70) @@ -89,13 +89,13 @@ func TestMagickCliFail(t *testing.T) { t.Fatalf(`MagickCli.EncodeJpeg(...) = nil, should be an error.`) } - if got, want := err.Error(), `^encoding image with ".*/testdata/bin/magick \[input -auto-orient -quality 70 output\]" error: .*$`; !regexp.MustCompile(want).MatchString(got) { + if got, want := err.Error(), `^encoding image with ".*/test_data/mock_bin/magick \[input -auto-orient -quality 70 output\]" error: .*$`; !regexp.MustCompile(want).MatchString(got) { t.Errorf(`MagickCli.EncodeJpeg(...) = %q, should be matched with reg pattern %q`, got, want) } } func TestMagickCliSucceed(t *testing.T) { - donePath := test_env.SetPathWithCurrent(testdataBinPath) + donePath := test_utils.SetPathWithCurrent(testdataBinPath) defer donePath() Magick = newMagickCli() diff --git a/api/scanner/media_encoding/executable_worker/testdata/bin/ffmpeg b/api/scanner/media_encoding/executable_worker/test_data/mock_bin/ffmpeg similarity index 100% rename from api/scanner/media_encoding/executable_worker/testdata/bin/ffmpeg rename to api/scanner/media_encoding/executable_worker/test_data/mock_bin/ffmpeg diff --git a/api/scanner/media_encoding/executable_worker/testdata/bin/ffprobe b/api/scanner/media_encoding/executable_worker/test_data/mock_bin/ffprobe similarity index 100% rename from api/scanner/media_encoding/executable_worker/testdata/bin/ffprobe rename to api/scanner/media_encoding/executable_worker/test_data/mock_bin/ffprobe diff --git a/api/scanner/media_encoding/executable_worker/testdata/bin/magick b/api/scanner/media_encoding/executable_worker/test_data/mock_bin/magick similarity index 100% rename from api/scanner/media_encoding/executable_worker/testdata/bin/magick rename to api/scanner/media_encoding/executable_worker/test_data/mock_bin/magick diff --git a/api/scanner/scanner_album_test.go b/api/scanner/scanner_album_test.go index 41068c3d..4e37c15b 100644 --- a/api/scanner/scanner_album_test.go +++ b/api/scanner/scanner_album_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" ) -const testDataPath = "./test_data" +const testDataPath = "./test_media/library" func TestNewRootPath(t *testing.T) { db := test_utils.DatabaseTest(t) @@ -29,7 +29,7 @@ func TestNewRootPath(t *testing.T) { } assert.NotNil(t, album) - assert.Contains(t, album.Path, "/api/scanner/test_data") + assert.Contains(t, album.Path, "/api/scanner/test_media") assert.NotEmpty(t, album.Owners) }) @@ -65,7 +65,7 @@ func TestNewRootPath(t *testing.T) { } assert.NotNil(t, album) - assert.Contains(t, album.Path, "/api/scanner/test_data") + assert.Contains(t, album.Path, "/api/scanner/test_media") ownerCount := db.Model(&album).Association("Owners").Count() assert.EqualValues(t, 2, ownerCount) diff --git a/api/scanner/scanner_tasks/cleanup_tasks/cleanup_media_test.go b/api/scanner/scanner_tasks/cleanup_tasks/cleanup_media_test.go index 8f9eaffa..6dcb06e4 100644 --- a/api/scanner/scanner_tasks/cleanup_tasks/cleanup_media_test.go +++ b/api/scanner/scanner_tasks/cleanup_tasks/cleanup_media_test.go @@ -10,6 +10,7 @@ import ( "github.com/photoview/photoview/api/graphql/models" "github.com/photoview/photoview/api/scanner/face_detection" "github.com/photoview/photoview/api/test_utils" + scanner_utils "github.com/photoview/photoview/api/test_utils/scanner" "github.com/stretchr/testify/assert" ) @@ -31,7 +32,7 @@ func TestCleanupMedia(t *testing.T) { } testDir := t.TempDir() - assert.NoError(t, copy.Copy("../../test_data", testDir)) + assert.NoError(t, copy.Copy("../../test_media/library", testDir)) countAllMedia := func() int { var allMedia []*models.Media @@ -79,31 +80,31 @@ func TestCleanupMedia(t *testing.T) { } t.Run("Modify albums", func(t *testing.T) { - test_utils.RunScannerOnUser(t, db, user1) + scanner_utils.RunScannerOnUser(t, db, user1) assert.Equal(t, 9, countAllMedia()) assert.Equal(t, 18, countAllMediaURLs()) // move faces directory assert.NoError(t, os.Rename(path.Join(testDir, "faces"), path.Join(testDir, "faces_moved"))) - test_utils.RunScannerAll(t, db) + scanner_utils.RunScannerAll(t, db) assert.Equal(t, 9, countAllMedia()) assert.Equal(t, 18, countAllMediaURLs()) // remove faces_moved directory assert.NoError(t, os.RemoveAll(path.Join(testDir, "faces_moved"))) - test_utils.RunScannerAll(t, db) + scanner_utils.RunScannerAll(t, db) assert.Equal(t, 3, countAllMedia()) assert.Equal(t, 6, countAllMediaURLs()) }) t.Run("Modify images", func(t *testing.T) { assert.NoError(t, os.Rename(path.Join(testDir, "buttercup_close_summer_yellow.jpg"), path.Join(testDir, "yellow-flower.jpg"))) - test_utils.RunScannerAll(t, db) + scanner_utils.RunScannerAll(t, db) assert.Equal(t, 3, countAllMedia()) assert.Equal(t, 6, countAllMediaURLs()) assert.NoError(t, os.Remove(path.Join(testDir, "lilac_lilac_bush_lilac.jpg"))) - test_utils.RunScannerAll(t, db) + scanner_utils.RunScannerAll(t, db) assert.Equal(t, 2, countAllMedia()) assert.Equal(t, 4, countAllMediaURLs()) }) diff --git a/api/scanner/scanner_tasks/processing_tasks/counterpart_files_task_test.go b/api/scanner/scanner_tasks/processing_tasks/counterpart_files_task_test.go index ed1158eb..f0efb838 100644 --- a/api/scanner/scanner_tasks/processing_tasks/counterpart_files_task_test.go +++ b/api/scanner/scanner_tasks/processing_tasks/counterpart_files_task_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/photoview/photoview/api/scanner/scanner_task" - "github.com/photoview/photoview/api/test_utils/test_env" + "github.com/photoview/photoview/api/test_utils" "github.com/photoview/photoview/api/utils" ) @@ -69,11 +69,11 @@ func TestCounterpartFilesTaskMediaFound(t *testing.T) { }, } - mediaPath := test_env.PathFromAPIRoot("scanner/test_data/fake_media") + mediaPath := test_utils.PathFromAPIRoot("scanner/test_media/fake_media") for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - done := test_env.SetEnv(string(utils.EnvDisableRawProcessing), fmt.Sprintf("%v", tc.disableRawProcessing)) + done := test_utils.SetEnv(string(utils.EnvDisableRawProcessing), fmt.Sprintf("%v", tc.disableRawProcessing)) defer done() ctx := scanner_task.NewTaskContext(context.Background(), nil, nil, nil) diff --git a/api/scanner/scanner_test.go b/api/scanner/scanner_test.go index 9e84b39d..f7e8e0cf 100644 --- a/api/scanner/scanner_test.go +++ b/api/scanner/scanner_test.go @@ -8,6 +8,7 @@ import ( "github.com/photoview/photoview/api/graphql/models" "github.com/photoview/photoview/api/scanner/face_detection" "github.com/photoview/photoview/api/test_utils" + scanner_utils "github.com/photoview/photoview/api/test_utils/scanner" "github.com/stretchr/testify/assert" ) @@ -27,7 +28,7 @@ func TestFullScan(t *testing.T) { rootAlbum := models.Album{ Title: "root album", - Path: "./test_data", + Path: "./test_media/library", } if !assert.NoError(t, db.Save(&rootAlbum).Error) { @@ -43,7 +44,7 @@ func TestFullScan(t *testing.T) { return } - test_utils.RunScannerOnUser(t, db, user) + scanner_utils.RunScannerOnUser(t, db, user) var allMedia []*models.Media if !assert.NoError(t, db.Find(&allMedia).Error) { diff --git a/api/scanner/test_data/fake_media/file.unknown b/api/scanner/test_media/fake_media/file.unknown similarity index 100% rename from api/scanner/test_data/fake_media/file.unknown rename to api/scanner/test_media/fake_media/file.unknown diff --git a/api/scanner/test_data/fake_media/fujifilm_raw.jpg b/api/scanner/test_media/fake_media/fujifilm_raw.jpg similarity index 100% rename from api/scanner/test_data/fake_media/fujifilm_raw.jpg rename to api/scanner/test_media/fake_media/fujifilm_raw.jpg diff --git a/api/scanner/test_data/fake_media/fujifilm_raw.raf b/api/scanner/test_media/fake_media/fujifilm_raw.raf similarity index 100% rename from api/scanner/test_data/fake_media/fujifilm_raw.raf rename to api/scanner/test_media/fake_media/fujifilm_raw.raf diff --git a/api/scanner/test_data/fake_media/standalone.jpg b/api/scanner/test_media/fake_media/standalone.jpg similarity index 100% rename from api/scanner/test_data/fake_media/standalone.jpg rename to api/scanner/test_media/fake_media/standalone.jpg diff --git a/api/scanner/test_data/buttercup_close_summer_yellow.jpg b/api/scanner/test_media/library/buttercup_close_summer_yellow.jpg similarity index 100% rename from api/scanner/test_data/buttercup_close_summer_yellow.jpg rename to api/scanner/test_media/library/buttercup_close_summer_yellow.jpg diff --git a/api/scanner/test_data/faces/boy1.jpg b/api/scanner/test_media/library/faces/boy1.jpg similarity index 100% rename from api/scanner/test_data/faces/boy1.jpg rename to api/scanner/test_media/library/faces/boy1.jpg diff --git a/api/scanner/test_data/faces/boy2.jpg b/api/scanner/test_media/library/faces/boy2.jpg similarity index 100% rename from api/scanner/test_data/faces/boy2.jpg rename to api/scanner/test_media/library/faces/boy2.jpg diff --git a/api/scanner/test_data/faces/girl_black_hair2.jpg b/api/scanner/test_media/library/faces/girl_black_hair2.jpg similarity index 100% rename from api/scanner/test_data/faces/girl_black_hair2.jpg rename to api/scanner/test_media/library/faces/girl_black_hair2.jpg diff --git a/api/scanner/test_data/faces/girl_blond1.jpg b/api/scanner/test_media/library/faces/girl_blond1.jpg similarity index 100% rename from api/scanner/test_data/faces/girl_blond1.jpg rename to api/scanner/test_media/library/faces/girl_blond1.jpg diff --git a/api/scanner/test_data/faces/girl_blond2.jpg b/api/scanner/test_media/library/faces/girl_blond2.jpg similarity index 100% rename from api/scanner/test_data/faces/girl_blond2.jpg rename to api/scanner/test_media/library/faces/girl_blond2.jpg diff --git a/api/scanner/test_data/faces/girl_blond3.jpg b/api/scanner/test_media/library/faces/girl_blond3.jpg similarity index 100% rename from api/scanner/test_data/faces/girl_blond3.jpg rename to api/scanner/test_media/library/faces/girl_blond3.jpg diff --git a/api/scanner/test_data/lilac_lilac_bush_lilac.jpg b/api/scanner/test_media/library/lilac_lilac_bush_lilac.jpg similarity index 100% rename from api/scanner/test_data/lilac_lilac_bush_lilac.jpg rename to api/scanner/test_media/library/lilac_lilac_bush_lilac.jpg diff --git a/api/scanner/test_data/mount_merapi_volcano_indonesia.jpg b/api/scanner/test_media/library/mount_merapi_volcano_indonesia.jpg similarity index 100% rename from api/scanner/test_data/mount_merapi_volcano_indonesia.jpg rename to api/scanner/test_media/library/mount_merapi_volcano_indonesia.jpg diff --git a/api/scanner/test_media/real_media/avi.avi b/api/scanner/test_media/real_media/avi.avi new file mode 100644 index 00000000..6db53dfa Binary files /dev/null and b/api/scanner/test_media/real_media/avi.avi differ diff --git a/api/scanner/test_media/real_media/bmp.bmp b/api/scanner/test_media/real_media/bmp.bmp new file mode 100644 index 00000000..688af718 Binary files /dev/null and b/api/scanner/test_media/real_media/bmp.bmp differ diff --git a/api/scanner/test_media/real_media/file.pdf b/api/scanner/test_media/real_media/file.pdf new file mode 100644 index 00000000..9ec444cf --- /dev/null +++ b/api/scanner/test_media/real_media/file.pdf @@ -0,0 +1,5 @@ +%PDF-1. +1 0 obj<>endobj +2 0 obj<>endobj +3 0 obj<>endobj +trailer <> \ No newline at end of file diff --git a/api/scanner/test_media/real_media/gif.gif b/api/scanner/test_media/real_media/gif.gif new file mode 100644 index 00000000..edaf2b97 Binary files /dev/null and b/api/scanner/test_media/real_media/gif.gif differ diff --git a/api/scanner/test_media/real_media/heif.heif b/api/scanner/test_media/real_media/heif.heif new file mode 100644 index 00000000..69dbdd7c Binary files /dev/null and b/api/scanner/test_media/real_media/heif.heif differ diff --git a/api/scanner/test_media/real_media/jpeg.jpg b/api/scanner/test_media/real_media/jpeg.jpg new file mode 100644 index 00000000..f083de6b Binary files /dev/null and b/api/scanner/test_media/real_media/jpeg.jpg differ diff --git a/api/scanner/test_media/real_media/jpeg2000.jp2 b/api/scanner/test_media/real_media/jpeg2000.jp2 new file mode 100644 index 00000000..2df7a58b Binary files /dev/null and b/api/scanner/test_media/real_media/jpeg2000.jp2 differ diff --git a/api/scanner/test_media/real_media/jpg_with_file.jpg b/api/scanner/test_media/real_media/jpg_with_file.jpg new file mode 100644 index 00000000..f083de6b Binary files /dev/null and b/api/scanner/test_media/real_media/jpg_with_file.jpg differ diff --git a/api/scanner/test_media/real_media/jpg_with_file.pdf b/api/scanner/test_media/real_media/jpg_with_file.pdf new file mode 100644 index 00000000..9ec444cf --- /dev/null +++ b/api/scanner/test_media/real_media/jpg_with_file.pdf @@ -0,0 +1,5 @@ +%PDF-1. +1 0 obj<>endobj +2 0 obj<>endobj +3 0 obj<>endobj +trailer <> \ No newline at end of file diff --git a/api/scanner/test_media/real_media/mkv.mkv b/api/scanner/test_media/real_media/mkv.mkv new file mode 100644 index 00000000..5b162de6 Binary files /dev/null and b/api/scanner/test_media/real_media/mkv.mkv differ diff --git a/api/scanner/test_media/real_media/mp4.mp4 b/api/scanner/test_media/real_media/mp4.mp4 new file mode 100644 index 00000000..1431e98d Binary files /dev/null and b/api/scanner/test_media/real_media/mp4.mp4 differ diff --git a/api/scanner/test_media/real_media/mpeg.mpg b/api/scanner/test_media/real_media/mpeg.mpg new file mode 100644 index 00000000..874d99b7 Binary files /dev/null and b/api/scanner/test_media/real_media/mpeg.mpg differ diff --git a/api/scanner/test_media/real_media/ogg.ogg b/api/scanner/test_media/real_media/ogg.ogg new file mode 100644 index 00000000..39558959 Binary files /dev/null and b/api/scanner/test_media/real_media/ogg.ogg differ diff --git a/api/scanner/test_media/real_media/png.png b/api/scanner/test_media/real_media/png.png new file mode 100644 index 00000000..91a99b94 Binary files /dev/null and b/api/scanner/test_media/real_media/png.png differ diff --git a/api/scanner/test_media/real_media/quicktime.mov b/api/scanner/test_media/real_media/quicktime.mov new file mode 100644 index 00000000..5e9d1788 Binary files /dev/null and b/api/scanner/test_media/real_media/quicktime.mov differ diff --git a/api/scanner/test_media/real_media/raw_with_file.pdf b/api/scanner/test_media/real_media/raw_with_file.pdf new file mode 100644 index 00000000..9ec444cf --- /dev/null +++ b/api/scanner/test_media/real_media/raw_with_file.pdf @@ -0,0 +1,5 @@ +%PDF-1. +1 0 obj<>endobj +2 0 obj<>endobj +3 0 obj<>endobj +trailer <> \ No newline at end of file diff --git a/api/scanner/test_media/real_media/raw_with_file.tiff b/api/scanner/test_media/real_media/raw_with_file.tiff new file mode 100644 index 00000000..e9e12cb6 Binary files /dev/null and b/api/scanner/test_media/real_media/raw_with_file.tiff differ diff --git a/api/scanner/test_media/real_media/raw_with_jpg.jpg b/api/scanner/test_media/real_media/raw_with_jpg.jpg new file mode 100644 index 00000000..f083de6b Binary files /dev/null and b/api/scanner/test_media/real_media/raw_with_jpg.jpg differ diff --git a/api/scanner/test_media/real_media/raw_with_jpg.tiff b/api/scanner/test_media/real_media/raw_with_jpg.tiff new file mode 100644 index 00000000..e9e12cb6 Binary files /dev/null and b/api/scanner/test_media/real_media/raw_with_jpg.tiff differ diff --git a/api/scanner/test_media/real_media/standalone_jpg.jpg b/api/scanner/test_media/real_media/standalone_jpg.jpg new file mode 100644 index 00000000..f083de6b Binary files /dev/null and b/api/scanner/test_media/real_media/standalone_jpg.jpg differ diff --git a/api/scanner/test_media/real_media/standalone_raw.tiff b/api/scanner/test_media/real_media/standalone_raw.tiff new file mode 100644 index 00000000..e9e12cb6 Binary files /dev/null and b/api/scanner/test_media/real_media/standalone_raw.tiff differ diff --git a/api/scanner/test_media/real_media/tiff.tiff b/api/scanner/test_media/real_media/tiff.tiff new file mode 100644 index 00000000..e9e12cb6 Binary files /dev/null and b/api/scanner/test_media/real_media/tiff.tiff differ diff --git a/api/scanner/test_media/real_media/webm.webm b/api/scanner/test_media/real_media/webm.webm new file mode 100644 index 00000000..c2121b52 Binary files /dev/null and b/api/scanner/test_media/real_media/webm.webm differ diff --git a/api/scanner/test_media/real_media/webp.webp b/api/scanner/test_media/real_media/webp.webp new file mode 100644 index 00000000..2f8bf8fa Binary files /dev/null and b/api/scanner/test_media/real_media/webp.webp differ diff --git a/api/scanner/test_media/real_media/wmv.wmv b/api/scanner/test_media/real_media/wmv.wmv new file mode 100644 index 00000000..d1094bda Binary files /dev/null and b/api/scanner/test_media/real_media/wmv.wmv differ diff --git a/api/test_utils/test_env/env.go b/api/test_utils/env.go similarity index 64% rename from api/test_utils/test_env/env.go rename to api/test_utils/env.go index a5c975f2..0b5c4ae4 100644 --- a/api/test_utils/test_env/env.go +++ b/api/test_utils/env.go @@ -1,24 +1,12 @@ -package test_env +package test_utils import ( - "flag" "os" "path/filepath" "runtime" "strings" ) -type integration_options struct { - Database *bool - Filesystem *bool -} - -// Fake flags to be compatible with current test command. -var integration_flags integration_options = integration_options{ - Database: flag.Bool("database", false, "run database integration tests"), - Filesystem: flag.Bool("filesystem", false, "run filesystem integration tests"), -} - func SetPathWithCurrent(paths ...string) func() { _, file, _, ok := runtime.Caller(1) if !ok { @@ -57,5 +45,5 @@ func PathFromAPIRoot(rootRelatedPath string) string { base := filepath.Dir(file) - return filepath.Join(base, "../..", rootRelatedPath) + return filepath.Join(base, "..", rootRelatedPath) } diff --git a/api/test_utils/test_env/env_test.go b/api/test_utils/env_test.go similarity index 83% rename from api/test_utils/test_env/env_test.go rename to api/test_utils/env_test.go index 0b0fd548..2fedaf6b 100644 --- a/api/test_utils/test_env/env_test.go +++ b/api/test_utils/env_test.go @@ -1,4 +1,4 @@ -package test_env +package test_utils import ( "os" @@ -20,7 +20,7 @@ func TestSetPathWithCurrent(t *testing.T) { defer testDone() path := os.Getenv("PATH") - if got, want := path, "api/test_utils/test_env/test"; !strings.HasSuffix(got, want) { + if got, want := path, "api/test_utils/test"; !strings.HasSuffix(got, want) { t.Errorf("path = %q, want a suffix: %q", got, want) } } diff --git a/api/test_utils/scanner_helpers.go b/api/test_utils/scanner/scanner_helpers.go similarity index 97% rename from api/test_utils/scanner_helpers.go rename to api/test_utils/scanner/scanner_helpers.go index ec3e719d..ecd04312 100644 --- a/api/test_utils/scanner_helpers.go +++ b/api/test_utils/scanner/scanner_helpers.go @@ -1,4 +1,4 @@ -package test_utils +package scanner_utils import ( "testing"