LP#1967770: Fix test for cover image upload
authorGalen Charlton <gmc@equinoxOLI.org>
Tue, 5 Apr 2022 14:44:25 +0000 (10:44 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 5 Apr 2022 14:47:18 +0000 (10:47 -0400)
The cover image upload test assumes that it will be run from exactly one
location, but that's not necessarily true.  This commit uses FindBin to
provide the right filesystem context for the test to find the files it
needs.

[Code by Galen, commit message by Mike]

Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/live_t/34-lp1787968-cover-uploader.t

index 66ae4ee..7e445fc 100644 (file)
@@ -8,6 +8,7 @@ use OpenILS::Utils::Fieldmapper;
 use LWP::UserAgent;
 use File::Fetch;
 use HTTP::Request::Common qw(POST);
+use FindBin;
 
 diag("test image uploader");
 
@@ -38,7 +39,7 @@ my $req = POST(
     Content_Type => 'multipart/form-data',
     Content => [
         # we're going for an image parse error
-        jacket_upload => [ '34-lp1787968-cover-uploader.t' ],
+        jacket_upload => [ "$FindBin::Bin/34-lp1787968-cover-uploader.t" ],
         bib_record => 1,
         ses => $authtoken
     ]
@@ -53,7 +54,7 @@ $req = POST(
     $target,
     Content_Type => 'multipart/form-data',
     Content => [
-        jacket_upload => [ '../../../web/images/green_check.png' ],
+        jacket_upload => [ "$FindBin::Bin/../../../web/images/green_check.png" ],
         bib_record => 1,
         ses => $authtoken
     ]