Thanks to Andrew Page for this suggestion.
By running the Catalyst server and using wget to get the page the
Controller recognises the username and password
wget --http-user=sage --http-password=s3cr3t http://linux:8001/svc/status
output
Authorization [sage][s3cr3t]
If I run the Catalyst server and then run my test as follows.
CATALYST_SERVER=http://linux:8001 make test
Then the output is
Authorization [][]
So, it appears that the problem is with my test script not passing the
credentials to the Catalyst App.
I will carry on working on this but any other suggestions are welcome.
Regards
Ian
Ian Docherty wrote:
Now this should work, but I can't make it do so. I can't read the
authorization username/password
In my test I have
----------
use strict;
use warnings;
use lib 't/lib';
use Test::More tests => 1;
my $mech = WWW::Test::Mechanize->new;
$mech->credentials('admin','s3cr3t');
$mech->get_ok("http://localhost/svc/status");
ok ($mech, 'Can mechanize');
1;
----------
In my controller I have
----------
sub auto : Private {
my ($self, $c) = @_;
my ($username, $password) = $c->req->headers->authorization_basic;
print STDERR "Authorization [$username][$password]\n";
}
----------
Which gives the output
----------
[Wed Jan 23 22:29:13 2008] 01_test.t: Use of uninitialized value in
concatenation (.) or string at /var/.../Controller/Svc.pm line 44.
[Wed Jan 23 22:29:13 2008] 01_test.t: Use of uninitialized value in
concatenation (.) or string at /var/.../Controller/Svc.pm line 44.
Authorization [][]
----------
In other words I can't seem to get access to the username password
Regards
Ian
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/