summaryrefslogtreecommitdiff
path: root/t/error.t
blob: 973da1642b73fe6e6a1bff5f10c714b3848ba891 (plain)
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
26
use lib '.';
use t::Helper;

my $app = t::Helper->make_app;
my $t   = Test::Mojo->new($app);

$t->app->ua->server($t->ua->server);

$app->routes->get(
  '/oauth-error' => sub {
    my $c = shift;

    $c->oauth2->get_token_p('test')->then(sub {
      return unless my $provider_res = shift;
      return $c->render(text => "Token $provider_res->{access_token}");
    })->catch(sub {
      return $c->render(text => shift, status => 500);
    });
  }
);

$t->get_ok('/oauth-error')->status_is(302);    # ->content_like(qr/bar/);
$t->get_ok('/oauth-error?code=123')->status_is(200);
$t->get_ok('/oauth-error?error=access_denied')->status_is(500);

done_testing;