summary refs log tree commit diff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/01_basic.t2
-rw-r--r--t/02_error.t17
-rw-r--r--t/03_serialization.t13
-rw-r--r--t/04_apimethod.t36
-rw-r--r--t/05_authentication.t67
5 files changed, 1 insertions, 134 deletions
diff --git a/t/01_basic.t b/t/01_basic.t
index 0958c36..1f51db1 100644
--- a/t/01_basic.t
+++ b/t/01_basic.t
@@ -11,7 +11,7 @@ use TestAPI;
 ok my $api = TestAPI->new(), 'api object created';
 
 for my $role (qw/UserAgent Format Authentication Serialization Request/) {
-    ok $api->meta->does_role('MooseX::Net::API::Role::' . $role),
+    ok $api->meta->does_role('Net::HTTP::API::Role::' . $role),
       'does role ' . $role;
 }
 
diff --git a/t/02_error.t b/t/02_error.t
deleted file mode 100644
index 3ab5dcc..0000000
--- a/t/02_error.t
+++ /dev/null
@@ -1,17 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-use Test::Exception;
-
-package test::api::missing_api_base_url;
-use MooseX::Net::API;
-
-net_api_method user => (method => 'GET', path => '/user/');
-
-package main;
-
-ok my $t = test::api::missing_api_base_url->new;
-dies_ok { $t->user } 'die with missing url';
-like $@, qr/'api_base_url' have not been defined/, 'missing api_base_url';
-
-done_testing;
diff --git a/t/03_serialization.t b/t/03_serialization.t
deleted file mode 100644
index 5fa45c2..0000000
--- a/t/03_serialization.t
+++ /dev/null
@@ -1,13 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-
-use MooseX::Net::API::Parser::XML;
-use MooseX::Net::API::Parser::JSON;
-use MooseX::Net::API::Parser::YAML;
-
-ok my $xml_parser = MooseX::Net::API::Parser::XML->new();
-ok my $yaml_parser = MooseX::Net::API::Parser::YAML->new();
-ok my $json_parser = MooseX::Net::API::Parser::JSON->new();
-
-done_testing;
diff --git a/t/04_apimethod.t b/t/04_apimethod.t
deleted file mode 100644
index cac2715..0000000
--- a/t/04_apimethod.t
+++ /dev/null
@@ -1,36 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-use Test::Exception;
-use MooseX::Net::API::Meta::Method;
-
-dies_ok {
-    MooseX::Net::API::Meta::Method->wrap(
-        name         => 'test_method',
-        package_name => 'test::api',
-        body         => sub {1},
-    );
-}
-"missing some params";
-
-ok my $method = MooseX::Net::API::Meta::Method->wrap(
-    name         => 'test_method',
-    package_name => 'test::api',
-    body         => sub {1},
-    method       => 'GET',
-    path         => '/user/',
-  ),
-  'method created';
-
-is $method->method, 'GET', 'method is GET';
-
-ok $method = MooseX::Net::API::Meta::Method->wrap(
-    name         => 'test_method',
-    package_name => 'test::api',
-    method       => 'GET',
-    path         => '/user/',
-    params       => [qw/name id street/],
-    required     => [qw/name id/],
-);
-
-done_testing;
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;