preaction / Yancy

The Best Web Framework Deserves the Best Content Management System
http://preaction.me/yancy/
Other
54 stars 21 forks source link

Problem installing on Mac OS 10.11 #55

Closed paulusr closed 5 years ago

paulusr commented 5 years ago

Hi,looking forward to trying out Yancy but got the following error:

t/plugin/auth/basic.t ........ 1/? 
    #   Failed test 'User is not authorized for API spec'
    #   at t/plugin/auth/basic.t line 119.
    #          got: '500'
    #     expected: '401'

    #   Failed test 'Content-Type is similar'
    #   at t/plugin/auth/basic.t line 119.
    #                   'text/html;charset=UTF-8'
    #     doesn't match '(?^:^application/json)'
    # Looks like you failed 2 tests of 21.

#   Failed test 'unauthenticated user cannot admin'
#   at t/plugin/auth/basic.t line 143.

    #   Failed test 'User is not authorized for API spec'
    #   at t/plugin/auth/basic.t line 272.
    #          got: '500'
    #     expected: '401'

    #   Failed test 'Content-Type is similar'
    #   at t/plugin/auth/basic.t line 272.
    #                   'text/html;charset=UTF-8'
    #     doesn't match '(?^:^application/json)'
    # Looks like you failed 2 tests of 32.
t/plugin/auth/basic.t ........ 6/? 
#   Failed test 'standalone plugin'
#   at t/plugin/auth/basic.t line 306.
# Looks like you failed 2 tests of 6.
t/plugin/auth/basic.t ........ Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/6 subtests 
t/plugin/form/bootstrap4.t ... ok   
t/standalone.t ............... ok   
t/util.t ..................... ok   

Test Summary Report
-------------------
t/plugin/auth/basic.t      (Wstat: 512 Tests: 6 Failed: 2)
  Failed tests:  2, 6
  Non-zero exit status: 2
Files=19, Tests=58, 28 wallclock secs ( 0.22 usr  0.06 sys + 26.18 cusr  1.27 csys = 27.73 CPU)
Result: FAIL
Failed 1/19 test programs. 2/58 subtests failed.
make: *** [test_dynamic] Error 255

I would be happy to try debug this myself if you can point me in the right direction. Thanks, Paul

lindleyw commented 5 years ago

I have also encountered this issue, with Linux Mint 18.1, perl 5.26. Have installed Mojolicious v8.12. Am trying to install Yancy v1.022.

Am getting an error in the build log as:

# Failed test 'User is not authorized for API spec' # at t/plugin/auth/basic.t line 119. # got: '500' # expected: '401'

Manually running:

prove -b t/plugin/auth/basic.t -v 2>&1 | less

I get:

[2019-02-03 08:58:16.17378] [22116] [error] Not a HASH reference at /home/MYUSER/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/Mojolicious/Plugin/OpenAPI.pm line 282.

which is the line:

if ($op_spec->{responses}{$status} or $op_spec->{responses}{default}) {

And by putting a Dumper($op_spec) above that, it turns out that $op_spec which is returned by line 277:

my $op_spec = $c->openapi->spec || {responses => {$status => {schema => $self->_default_schema}}};

is indeed not a hash, but instead a Mojo::Collection object, containing one item which is the expected hash. I'm not sure why OpenAPI is doing that.

preaction commented 5 years ago

My guess is that's this issue: https://github.com/jhthorsen/mojolicious-plugin-openapi/issues/107

If you install Mojolicious::Plugin::OpenAPI v2.09 manually (cpanm Mojolicious::Plugin::OpenAPI@2.09) it should work.

paulusr commented 5 years ago

That did the trick, thanks!

lindleyw commented 5 years ago

Confirmed working here also. Cheers.

preaction commented 5 years ago

v1.023 fixes this with an increased dependency on Mojolicious::Plugin::OpenAPI 2.12. Thanks for the report!