-
-
Save hesco/a8118bc57c35cbe55788657613a9a704 to your computer and use it in GitHub Desktop.
Why is ->status suddenly not available to me. Firefox inspector shows me a 200 OK, for this request.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ok 1 - GET / | |
ok 2 - 200 OK | |
ok 3 - content is similar | |
[Sun Jan 28 21:02:44 2018] [debug] GET "/v1/app/protected" | |
[Sun Jan 28 21:02:44 2018] [debug] Routing to a callback | |
[Sun Jan 28 21:02:44 2018] [debug] 200 OK (0.001546s, 646.831/s) | |
ok 4 - GET /v1/app/protected | |
Can't locate object method "status" via package "Test::Mojo" at t/0020-my_app-controller-user_session.t line 17. | |
# Tests were run but no plan was declared and done_testing() was not seen. | |
# Looks like your test exited with 255 just after 4. | |
Dubious, test returned 255 (wstat 65280, 0xff00) | |
All 4 subtests passed | |
Test Summary Report | |
------------------- | |
t/0020-green_party_api-controller-user_session.t (Wstat: 65280 Tests: 4 Failed: 0) | |
Non-zero exit status: 255 | |
Parse errors: No plan found in TAP output | |
Files=1, Tests=4, 1 wallclock secs ( 0.03 usr 0.01 sys + 0.89 cusr 0.04 csys = 0.97 CPU) | |
Result: FAIL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use lib 'lib', 'local/lib/perl5'; | |
use Mojo::Base -strict; | |
use Test::More; | |
use Test::Mojo; | |
use MyApp::Controller::UserSessions; | |
my $user_name = 'Foo Bar'; | |
my $userid = 'fbar'; | |
my $pw = 'secret'; | |
my $t = Test::Mojo->new('MyApp'); | |
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i); | |
$t->get_ok('/v1/app/protected') | |
->status(401) # <--- this is where things blow up | |
->content_like('must be authenticated to access'); | |
$t->get_ok('/v1/app/loggedin') | |
->status(200) | |
->content_like('no session found'); | |
etc., etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment