Skip to content

Commit

Permalink
add test for set_fields with upload and text
Browse files Browse the repository at this point in the history
  • Loading branch information
simbabque committed Aug 14, 2022
1 parent 525caf8 commit 829aec4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/file_upload.html
@@ -1,4 +1,5 @@
<form method="post" enctype="multipart/form-data">
<input type="file" name="document">
<input type="text" name="another_field">
<input type="submit">
</form>
8 changes: 8 additions & 0 deletions t/file_upload.t
Expand Up @@ -92,6 +92,14 @@ $as_string = $form->make_request->as_string;
like( $as_string, qr! filename="$filename" !x,
q/$mc->set_fields( 'document' => [[ undef, $filename, Content => 'content' ], 1] )/ );

# &set_fields with multiple fields
$mc->get( $uri );
$mc->set_fields( 'another_field' => 'foo', 'document' => [ $file, $filename ] );
($form) = $mc->forms;
like( $form->make_request->as_string, qr! filename="$filename" !x,
q/$mc->set_fields( 'another_field' => 'foo', 'document' => [ $file, $filename ] )/ );


# field does not exist
$mc->get( $uri );
lives_ok { $mc->set_fields( 'does_not_exist' => [ [$file], 1 ] ) }
Expand Down

0 comments on commit 829aec4

Please sign in to comment.