Discussion:
Mojolicious::Plugin::Authorization now fails its test suite.
(too old to reply)
David Oswald
2012-12-20 05:52:37 UTC
Permalink
Has anyone else noticed this behavior? A few months back I installed
Mojolocious::Plugin::Authorization, and was using it successfully. A
week or so ago I set up a new system with a fresh install of
Mojolicious, and upon attempting to install M::P::Authorization found
that it is now failing a couple of its tests.

There doesn't seem to have been an update to this module in the past
few months, so for it to start failing now means something else has
changed; possibly some change to Mojolicious where M::P::Author may
have been relying on undocumented behavior?

I'm attempting to install Mojolicious::Plugin::Authorization v1.03
(May-12) against Mojolicious v3.68 (Dec-12), and get failures on two
of the tests in t/01-functional.t.



--

David Oswald
***@gmail.com
John Scoles
2012-12-20 11:48:38 UTC
Permalink
Just noticed it my self. I will look into it today. May be a perl 16.1 platform problem as it seems to pass 16.2 on other platforms??
Date: Wed, 19 Dec 2012 21:52:37 -0800
Subject: [Mojolicious] Mojolicious::Plugin::Authorization now fails its test suite.
Has anyone else noticed this behavior? A few months back I installed
Mojolocious::Plugin::Authorization, and was using it successfully. A
week or so ago I set up a new system with a fresh install of
Mojolicious, and upon attempting to install M::P::Authorization found
that it is now failing a couple of its tests.
There doesn't seem to have been an update to this module in the past
few months, so for it to start failing now means something else has
changed; possibly some change to Mojolicious where M::P::Author may
have been relying on undocumented behavior?
I'm attempting to install Mojolicious::Plugin::Authorization v1.03
(May-12) against Mojolicious v3.68 (Dec-12), and get failures on two
of the tests in t/01-functional.t.
--
David Oswald
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
John Scoles
2012-12-20 12:04:05 UTC
Permalink
What version of perl and what OS are you using? Might be that. Looking at the test it is about as simple as it comes $t->get_ok('/priv2')->status_is(200)->content_is('fail');
get '/priv2' => sub {
my $self = shift;
unless ($self->has_priv('priv2')) {
$self->render(text=>'fail');
}
$self->render(text=>'Priv 2');
Date: Wed, 19 Dec 2012 21:52:37 -0800
Subject: [Mojolicious] Mojolicious::Plugin::Authorization now fails its test suite.
Has anyone else noticed this behavior? A few months back I installed
Mojolocious::Plugin::Authorization, and was using it successfully. A
week or so ago I set up a new system with a fresh install of
Mojolicious, and upon attempting to install M::P::Authorization found
that it is now failing a couple of its tests.
There doesn't seem to have been an update to this module in the past
few months, so for it to start failing now means something else has
changed; possibly some change to Mojolicious where M::P::Author may
have been relying on undocumented behavior?
I'm attempting to install Mojolicious::Plugin::Authorization v1.03
(May-12) against Mojolicious v3.68 (Dec-12), and get failures on two
of the tests in t/01-functional.t.
--
David Oswald
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
Stefan Adams
2012-12-20 16:31:45 UTC
Permalink
Post by John Scoles
What version of perl and what OS are you using? Might be that.
It fails for me with perlbrew using 5.16.2

# perl -v
This is perl 5, version 16, subversion 2 (v5.16.2) built for i686-linux

# make test
PERL_DL_NONLAZY=1 /root/perl5/perlbrew/perls/perl-5.16.2/bin/perl
"-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')"
t/*.t
t/00-load.t ............... ok
t/01-functional.t ......... 1/42
# Failed test 'exact match for content'
# at t/01-functional.t line 117.
# got: 'Priv 2'
# expected: 'fail'

# Failed test 'exact match for content'
# at t/01-functional.t line 119.
# got: 'Priv 2'
# expected: 'fail'
t/01-functional.t ......... 22/42 # Looks like you failed 2 tests of 42.
t/01-functional.t ......... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/42 subtests

# uname -a
Linux netsanapp.il.local 2.6.29.6-server-2mnb #1 SMP Sun Aug 16 23:47:22
EDT 2009 i686 Quad-Core AMD Opteron(tm) Processor 2374 HE GNU/Linux

The OS is Mandriva 2009.1
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
Sebastian Riedel
2012-12-20 16:34:55 UTC
Permalink
Post by John Scoles
get '/priv2' => sub {
my $self = shift;
unless ($self->has_priv('priv2')) {
$self->render(text=>'fail');
}
$self->render(text=>'Priv 2');
};
perhaps the unless is not working as expected and the second render is comming up??
or maybe I need a return in the unless as it might be falling though to the second render??
This, the code only worked by accident before.

--
Sebastian Riedel
http://twitter.com/kraih
http://mojolicio.us
David Oswald
2012-12-20 16:50:15 UTC
Permalink
So it should be written like this?:

get '/priv2' => sub {
my $self = shift;
unless( $self->has_priv('priv2')) {
$self->render(text=>'fail');
return;
}
$self->render(text=>'Priv 2');
}

Seems an easy fix for the test. The POD probably ought to be updated
to mention this easy mistake as well.
Post by Sebastian Riedel
Post by John Scoles
get '/priv2' => sub {
my $self = shift;
unless ($self->has_priv('priv2')) {
$self->render(text=>'fail');
}
$self->render(text=>'Priv 2');
};
perhaps the unless is not working as expected and the second render is comming up??
or maybe I need a return in the unless as it might be falling though to the second render??
This, the code only worked by accident before.
--
Sebastian Riedel
http://twitter.com/kraih
http://mojolicio.us
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
--
David Oswald
***@gmail.com
Sebastian Riedel
2012-12-20 16:57:51 UTC
Permalink
Yes, but that's more verbose than it has to be.

get '/priv2' => sub {
my $self = shift;
return $self->render(text => 'Fail!') unless $self->has_priv('priv2');
$self->render(text => 'Priv2!');
};

--
Sebastian Riedel
http://twitter.com/kraih
http://mojolicio.us
John Stoffel
2012-12-20 18:01:36 UTC
Permalink
Sebastian> Yes, but that's more verbose than it has to be.

Sebastian> get '/priv2' => sub {
Sebastian> my $self = shift;
Sebastian> return $self->render(text => 'Fail!') unless $self->has_priv('priv2');
Sebastian> $self->render(text => 'Priv2!');
Sebastian> };

Verbose is good. Being explicit is good. Heck, not being smart and
spelling it out like this is even better:

get '/priv2' => sub {
my $self = shift;
if ($self->has_prov('priv2')) {
return $self->render(text => 'Priv2!');
} else {
return $self->render(text => 'Fail!');
}
};

It's verbose, it's crystal clear what's happening and what's
expected. Perfect as both a test AND as documentation on how to use
the feature.

John
John Scoles
2012-12-20 18:19:43 UTC
Permalink
Nic Sandfield already gave he a patch - unless ($self->has_priv('priv1')) {
- $self->render(text=>'fail');
- } - $self->render(text=>'Priv 1');
+ $self->render(text=> $self->has_priv('priv1') ? 'Priv 1' : 'fail');

even less verbose. Though I am not a big fan of inline ifs. It does read well as long as you know what ?: does I might just do it a few ways to add some more examples. Funny why it worked by accident before was something 'fixed' in Mojo??? Would like to know what?? Cheers > Date: Thu, 20 Dec 2012 13:01:36 -0500
Subject: Re: [Mojolicious] Mojolicious::Plugin::Authorization now fails its test suite.
Sebastian> Yes, but that's more verbose than it has to be.
Sebastian> get '/priv2' => sub {
Sebastian> my $self = shift;
Sebastian> return $self->render(text => 'Fail!') unless $self->has_priv('priv2');
Sebastian> $self->render(text => 'Priv2!');
Sebastian> };
Verbose is good. Being explicit is good. Heck, not being smart and
get '/priv2' => sub {
my $self = shift;
if ($self->has_prov('priv2')) {
return $self->render(text => 'Priv2!');
} else {
return $self->render(text => 'Fail!');
}
};
It's verbose, it's crystal clear what's happening and what's
expected. Perfect as both a test AND as documentation on how to use
the feature.
John
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
Stefan Adams
2013-08-17 21:23:19 UTC
Permalink
John,

I just tried installing Mojolicious::Plugin::Authorization with perlbrew
5.18.1 and Mojolicious 4.25 and it failed. Let me know if there's any
additional information I can provide you for this.

Checksum for
/root/.cpan/sources/authors/id/B/BY/BYTEROCK/Mojolicious-Plugin-Authorization-1.0301.tar.gz
ok

CPAN.pm: Building
B/BY/BYTEROCK/Mojolicious-Plugin-Authorization-1.0301.tar.gz

Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Mojolicious-Plugin-Authorization' version
'1.0301'
Building Mojolicious-Plugin-Authorization
BYTEROCK/Mojolicious-Plugin-Authorization-1.0301.tar.gz
./Build -- OK
'YAML' not installed, will not store persistent state
Running Build test
t/00-load.t ............... ok
t/01-functional.t ......... 1/42
# Failed test 'exact match for content'
# at t/01-functional.t line 110.
# got: 'priv2:priv1'
# expected: 'priv1:priv2'
# Looks like you failed 1 test of 42.
t/01-functional.t ......... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/42 subtests
t/manifest.t .............. skipped: Author tests not required for
installation
t/release-cpan-changes.t .. skipped: these tests are for release candidate
testing
Post by John Scoles
Nic Sandfield already gave he a patch
- unless ($self->has_priv('priv1')) {
- $self->render(text=>'fail');
- }
- $self->render(text=>'Priv 1');
+ $self->render(text=> $self->has_priv('priv1') ? 'Priv 1' : 'fail');
even less verbose.
Though I am not a big fan of inline ifs.
It does read well as long as you know what ?: does
I might just do it a few ways to add some more examples.
Funny why it worked by accident before was something 'fixed' in Mojo???
Would like to know what??
Cheers
Post by John Scoles
Date: Thu, 20 Dec 2012 13:01:36 -0500
Subject: Re: [Mojolicious] Mojolicious::Plugin::Authorization now fails
its test suite.
Post by John Scoles
Sebastian> Yes, but that's more verbose than it has to be.
Sebastian> get '/priv2' => sub {
Sebastian> my $self = shift;
Sebastian> return $self->render(text => 'Fail!') unless
$self->has_priv('priv2');
Post by John Scoles
Sebastian> $self->render(text => 'Priv2!');
Sebastian> };
Verbose is good. Being explicit is good. Heck, not being smart and
get '/priv2' => sub {
my $self = shift;
if ($self->has_prov('priv2')) {
return $self->render(text => 'Priv2!');
} else {
return $self->render(text => 'Fail!');
}
};
It's verbose, it's crystal clear what's happening and what's
expected. Perfect as both a test AND as documentation on how to use
the feature.
John
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
Post by John Scoles
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/mojolicious?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/mojolicious?hl=en.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.
Dotan Dimet
2013-08-18 08:06:49 UTC
Permalink
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="UTF-8" bgcolor="#FFFFFF"
text="#000000">
<div class="moz-cite-prefix">It looks like the test breaks in perl
5.18.1 because of the hash order randomization change.<br>
It expects the list returned by keys %xxx to always be in a
certain order, which is no longer the case after 5.18<br>
- Dotan<br>
<br>
<br>
On 08/18/2013 12:23 AM, Stefan Adams wrote:<br>
</div>
<blockquote
cite="mid:CADfyOg4SnN0Em+9NAVghkZAUK0rFQY9fDkL=***@mail.gmail.com"
type="cite">
<div dir="ltr">John,
<div><br>
</div>
<div style="">I just tried installing
Mojolicious::Plugin::Authorization with perlbrew 5.18.1 and
Mojolicious 4.25 and it failed.  Let me know if there's any
additional information I can provide you for this.</div>
<div style=""><br>
</div>
<div style="">
<div>Checksum for
/root/.cpan/sources/authors/id/B/BY/BYTEROCK/Mojolicious-Plugin-Authorization-1.0301.tar.gz
ok</div>
<div><br>
</div>
<div>  CPAN.pm: Building
B/BY/BYTEROCK/Mojolicious-Plugin-Authorization-1.0301.tar.gz</div>
<div><br>
</div>
<div>Created MYMETA.yml and MYMETA.json</div>
<div>Creating new 'Build' script for
'Mojolicious-Plugin-Authorization' version '1.0301'</div>
<div>Building Mojolicious-Plugin-Authorization</div>
<div>  BYTEROCK/Mojolicious-Plugin-Authorization-1.0301.tar.gz</div>
<div>  ./Build -- OK</div>
<div>'YAML' not installed, will not store persistent state</div>
<div>Running Build test</div>
<div>t/00-load.t ............... ok   </div>
<div>t/01-functional.t ......... 1/42 </div>
<div>#   Failed test 'exact match for content'</div>
<div>#   at t/01-functional.t line 110.</div>
<div>#          got: 'priv2:priv1'</div>
<div>#     expected: 'priv1:priv2'</div>
<div># Looks like you failed 1 test of 42.</div>
<div>t/01-functional.t ......... Dubious, test returned 1
(wstat 256, 0x100)</div>
<div>Failed 1/42 subtests </div>
<div>t/manifest.t .............. skipped: Author tests not
required for installation</div>
<div>t/release-cpan-changes.t .. skipped: these tests are for
release candidate testing</div>
<div><br>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Dec 20, 2012 at 12:19 PM, John
Scoles <span dir="ltr">&lt;<a moz-do-not-send="true"
href="mailto:***@hotmail.com" target="_blank">***@hotmail.com</a>&gt;</span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<img moz-do-not-send="true" height="24" width="24"><span><span
rel="author">Nic Sandfield already gave he a patch</span></span><br>
<span><span rel="author"></span></span> <br>
-   unless ($self-&gt;has_priv('priv1')) { <br>
-     $self-&gt;render(text=&gt;'fail'); <br>
-   } <br>
-   $self-&gt;render(text=&gt;'Priv 1'); <br>
+   $self-&gt;render(text=&gt;
$self-&gt;has_priv('priv1') ? 'Priv 1' : 'fail'); <br>
<br>
<br>
 even less verbose.<br>
 <br>
Though I am not a big fan of inline ifs.<br>
 <br>
It does read well as long as you know what ?: does<br>
 <br>
I might just do it a few ways to add some more examples.<br>
 <br>
Funny why it worked by accident before was something
'fixed' in Mojo???<br>
 <br>
Would like to know what??<br>
 <br>
Cheers<br>
�<br> <div>&gt; Date: Thu, 20 Dec 2012 13:01:36 -0500<br>
&gt; From: <a moz-do-not-send="true"
href="mailto:***@stoffel.org" target="_blank">***@stoffel.org</a><br>
&gt; To: <a moz-do-not-send="true"
href="mailto:***@googlegroups.com"
target="_blank">***@googlegroups.com</a><br>
&gt; Subject: Re: [Mojolicious]
Mojolicious::Plugin::Authorization now fails its test
suite.
<div>
<div class="h5"><br>
&gt; <br>
&gt; <br>
&gt; &gt;&gt; So it should be written like this?:<br>
&gt; Sebastian&gt; Yes, but that's more verbose
than it has to be.<br>
&gt; <br>
&gt; Sebastian&gt; get '/priv2' =&gt; sub {<br>
&gt; Sebastian&gt; my $self = shift;<br>
&gt; Sebastian&gt; return $self-&gt;render(text
=&gt; 'Fail!') unless $self-&gt;has_priv('priv2');<br>
&gt; Sebastian&gt; $self-&gt;render(text =&gt;
'Priv2!');<br>
&gt; Sebastian&gt; };<br>
&gt; <br>
&gt; Verbose is good. Being explicit is good.
Heck, not being smart and<br>
&gt; spelling it out like this is even better:<br>
&gt; <br>
&gt; get '/priv2' =&gt; sub {<br>
&gt; my $self = shift;<br>
&gt; if ($self-&gt;has_prov('priv2')) {<br>
&gt; return $self-&gt;render(text =&gt; 'Priv2!');
<br>
&gt; } else { <br>
&gt; return $self-&gt;render(text =&gt; 'Fail!');<br>
&gt; }<br>
&gt; };<br>
&gt; <br>
&gt; It's verbose, it's crystal clear what's
happening and what's<br>
&gt; expected. Perfect as both a test AND as
documentation on how to use<br>
&gt; the feature.<br>
&gt; <br>
&gt; John<br>
&gt; <br>
&gt; -- <br>
&gt; You received this message because you are
subscribed to the Google Groups "Mojolicious"
group.<br>
&gt; To post to this group, send email to <a
moz-do-not-send="true"
href="mailto:***@googlegroups.com"
target="_blank">***@googlegroups.com</a>.<br>
&gt; To unsubscribe from this group, send email to
<a moz-do-not-send="true"
href="mailto:mojolicious%***@googlegroups.com"
target="_blank">mojolicious+***@googlegroups.com</a>.<br>
&gt; For more options, visit this group at <a
moz-do-not-send="true"
href="http://groups.google.com/group/mojolicious?hl=en"
target="_blank">http://groups.google.com/group/mojolicious?hl=en</a>.<br>
&gt; <br>
</div>
</div>
</div>
</div>
</div>
<div class="HOEnZb">
<div class="h5">
-- <br>
You received this message because you are subscribed to
the Google Groups "Mojolicious" group.<br>
To post to this group, send email to <a
moz-do-not-send="true"
href="mailto:***@googlegroups.com"
target="_blank">***@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a
moz-do-not-send="true"
href="mailto:mojolicious%***@googlegroups.com"
target="_blank">mojolicious+***@googlegroups.com</a>.<br>
For more options, visit this group at <a
moz-do-not-send="true"
href="http://groups.google.com/group/mojolicious?hl=en"
target="_blank">http://groups.google.com/group/mojolicious?hl=en</a>.<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
-- <br>
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.<br>
To unsubscribe from this group and stop receiving emails from it,
send an email to <a class="moz-txt-link-abbreviated" href="mailto:mojolicious+***@googlegroups.com">mojolicious+***@googlegroups.com</a>.<br>
To post to this group, send email to <a class="moz-txt-link-abbreviated" href="mailto:***@googlegroups.com">***@googlegroups.com</a>.<br>
Visit this group at <a moz-do-not-send="true"
href="http://groups.google.com/group/mojolicious">http://groups.google.com/group/mojolicious</a>.<br>
For more options, visit <a moz-do-not-send="true"
href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br>
</blockquote>
<br>
<br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.
</body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &quot;Mojolicious&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.<br />
To post to this group, send email to ***@googlegroups.com.<br />
Visit this group at <a href="http://groups.google.com/group/mojolicious">http://groups.google.com/group/mojolicious</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />
Stefan Adams
2013-08-18 17:22:16 UTC
Permalink
It looks like the test breaks in perl 5.18.1 because of the hash order
randomization change.
It expects the list returned by keys %xxx to always be in a certain order,
which is no longer the case after 5.18
- Dotan
Thanks, Dotan! At least I know now that I can do a force install with no
regrets later. Hopefully John Scoles will see this and update his plugin
again.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.
Continue reading on narkive:
Loading...