File: remote-user.t

package info (click to toggle)
libmojolicious-plugin-cgi-perl 0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 188 kB
  • ctags: 13
  • sloc: perl: 211; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 776 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use warnings;
use strict;
use Test::More;
use Test::Mojo;

plan skip_all => 't/cgi-bin/working.pl' unless -x 't/cgi-bin/working.pl';

{
  use Mojolicious::Lite;
  plugin CGI => {route => '/auth', script => 't/cgi-bin/env.cgi', env => {}};
}

my $t = Test::Mojo->new;

$t->get_ok('/auth')->status_is(200)->status_is(200)->content_like(qr{^REMOTE_USER=}m, 'REMOTE_USER=');

$t->get_ok($t->tx->req->url->clone->userinfo('Aladdin:foopass'), {'Authorization' => ''})->status_is(200)
  ->content_like(qr{^REMOTE_USER=Aladdin$}m, 'REMOTE_USER=Aladdin');

$t->get_ok($t->tx->req->url->clone->userinfo('whatever:foopass'),
  {'Authorization' => 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='})->status_is(200)
  ->content_like(qr{^REMOTE_USER=Aladdin$}m, 'REMOTE_USER=Aladdin');


done_testing;