File: catalyst-action-deserialize-multipart.t

package info (click to toggle)
libcatalyst-action-rest-perl 1.21-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 476 kB
  • sloc: perl: 1,750; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 1,023 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use warnings;
use Test::More;
use Test::Requires qw(YAML::Syck);
use YAML::Syck;
use FindBin;

use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken");
use Test::Rest;

my $t = Test::Rest->new('content_type' => 'multipart/mixed; boundary=----------------------------0b922a55b662');

use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST';
my $url = '/deserializemultipart/test';

my $req = $t->put( url => $url, data => qq(------------------------------0b922a55b662\r\nContent-Disposition: form-data; name="REST"; filename="-"\r\nContent-Type: text/x-yaml\r\n\r\n---\r\nkitty: LouLou\r\n------------------------------0b922a55b662\r\nContent-Disposition: form-data; name="other"; filename="foo.txt"\r\nContent-Type: application/octet-stream\r\n\r\nanother part\r\n------------------------------0b922a55b662--\r\n));
my $res = request($req);

ok( $res->is_success, 'PUT Deserialize request succeeded' );
is( $res->content, "LouLou|12", "Request returned deserialized data");

done_testing;