Skip to content

Commit

Permalink
wip: upload text file to html
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Oct 10, 2024
1 parent ea89719 commit 51d9169
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script/rvd_front
Original file line number Diff line number Diff line change
Expand Up @@ -1900,12 +1900,14 @@ sub _upload_users_csv($c, $csv, $type, $create) {
};

return $c->render(json =>
{ output => $output
{
output => $output
,error => $error
,done => 1
}) if $c->stash('req') eq 'json';

return $c->render(template => "/main/upload_users"
,output => $output
,error => $error
,done => 1
);
Expand Down
15 changes: 15 additions & 0 deletions t/mojo/60_upload.t
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,20 @@ sub _do_test_upload_json_users_pass($mojo) {
}
}

sub test_upload_html() {

$t->get_ok('/admin/users/upload.html')->status_is(200);

my $users = new_domain_name();

$t->post_ok('/admin/users/upload.html' => form => {
type => 'openid'
,create => 0
,users => { content => $users, filename => 'users.txt', 'Content-Type' => 'text/csv' },
}
)->status_is(200);
}

################################################################################

$ENV{MOJO_MODE} = 'development';
Expand All @@ -738,6 +752,7 @@ test_upload_no_admin($t);

_login($t);

test_upload_html();
test_upload_json_fail();

test_upload_json();
Expand Down

0 comments on commit 51d9169

Please sign in to comment.