mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-08-06 08:53:03 +02:00
Fix #76 Add .zip file check in the tests
This commit is dedicated to Nartagnan, who is supporting me with Ğ1. Many thanks :-)
This commit is contained in:
@@ -15,6 +15,7 @@ Revision history for Lutim
|
||||
- Add CLI command to print informations about images
|
||||
- Add CLI command to remove images
|
||||
- Add CLI command to search images based on the uploader's IP address
|
||||
- Add .zip file check in the tests
|
||||
|
||||
0.10.4 2018-05-07
|
||||
- Fix bug in cache system that would allow someone to view an image with an incorrect decryption key
|
||||
|
||||
@@ -9,6 +9,7 @@ use Test::Mojo;
|
||||
|
||||
use FindBin qw($Bin);
|
||||
use Digest::file qw(digest_file_hex);
|
||||
use IO::Uncompress::Unzip qw($UnzipError);
|
||||
|
||||
my ($m, $cfile);
|
||||
|
||||
@@ -108,6 +109,26 @@ $t->get_ok('/'.$short)
|
||||
$t->get_ok('/'.$short)
|
||||
->status_is(302);
|
||||
|
||||
# Get zip file and test it
|
||||
$t->get_ok('/zip?i='.$short)
|
||||
->status_is(200)
|
||||
->header_is('Content-Disposition' => 'attachment;filename=images.zip');
|
||||
|
||||
my $zip = $t->ua->get('/zip?i='.$short)->res->body;
|
||||
my $u = new IO::Uncompress::Unzip \$zip
|
||||
or die "Cannot open zip file: $UnzipError";
|
||||
|
||||
my $status;
|
||||
my @files = qw(hosted_with_lutim.png images/ images/Lutim.png.txt);
|
||||
for ($status = 1; $status > 0; $status = $u->nextStream()) {
|
||||
my $name = $u->getHeaderInfo()->{Name};
|
||||
is($name, shift(@files));
|
||||
my $buff;
|
||||
while (($status = $u->read($buff)) > 0) {
|
||||
}
|
||||
last if $status < 0;
|
||||
}
|
||||
|
||||
# Delete image with token
|
||||
$raw = $t->ua->post('/' => form => { file => { file => $image }, format => 'json' })->res;
|
||||
my $rshort = $raw->json('/msg/real_short');
|
||||
|
||||
Reference in New Issue
Block a user