From 5fdee9e79b5b6a72522bee59e4bd7c62506a43c7 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Fri, 16 Jul 2010 16:12:32 +0200 Subject: remove tests and old lib; use base net::http::api; DEPRECATED --- t/05_authentication.t | 67 --------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 t/05_authentication.t (limited to 't/05_authentication.t') diff --git a/t/05_authentication.t b/t/05_authentication.t deleted file mode 100644 index e769a53..0000000 --- a/t/05_authentication.t +++ /dev/null @@ -1,67 +0,0 @@ -use strict; -use warnings; -use Test::More; - -package test::auth; -use MooseX::Net::API; - -net_api_declare fake_auth => ( - api_base_url => 'http://localhost', - format => 'json', - authentication => 1, - authentication_method => 'my_auth', -); - -net_api_method user => ( - method => 'GET', - path => '/user/', -); - -sub my_auth { - my ($self, $request, $ua, $h) = @_; - $request->header('Authentication' => 1); -} - -package test::auth::simple; -use MooseX::Net::API; - -net_api_declare fake_auth => ( - api_base_url => 'http://localhost', - format => 'json', - authentication => 1, -); - -net_api_method user => ( - method => 'GET', - path => '/user/', -); - -package main; - -ok my $api = test::auth->new, 'object api created'; -$api->api_useragent->add_handler( - request_send => sub { - my $request = shift; - is $request->header('Authentication'), 1, 'authentication header is set'; - my $res = HTTP::Response->new(200); - $res->content('[{"name":"eris"}]'); - $res; - } -); -ok $api->user, 'method user success'; - -ok $api = - test::auth::simple->new(api_username => 'foo', api_password => 'bar'), - 'object api simple created'; -$api->api_useragent->add_handler( - request_send => sub { - my $request = shift; - ok $request->header('authorization'), 'authentication header is set'; - my $res = HTTP::Response->new(200); - $res->content('[{"name":"eris"}]'); - $res; - } -); -ok $api->user, 'method user success'; - -done_testing; -- cgit v1.2.3