summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--t/04_wow.t16
-rw-r--r--t/lib/WoWArmory.pm25
2 files changed, 41 insertions, 0 deletions
diff --git a/t/04_wow.t b/t/04_wow.t
new file mode 100644
index 0000000..ea87d8c
--- /dev/null
+++ b/t/04_wow.t
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use lib ('t/lib');
+
+use Test::More;
+use WoWArmory;
+
+my ( $obj, $res );
+
+ok $obj = WoWArmory->new();
+
+ok $res = $obj->character( r => 'Elune', n => 'Aarnn' );
+is $res->{characterInfo}->{character}->{name}, 'Aarnn',
+    '... got valid player name';
+done_testing();
+
diff --git a/t/lib/WoWArmory.pm b/t/lib/WoWArmory.pm
new file mode 100644
index 0000000..c2715d1
--- /dev/null
+++ b/t/lib/WoWArmory.pm
@@ -0,0 +1,25 @@
+package WoWArmory;
+use Moose;
+use MooseX::Net::API;
+use LWP::UserAgent;
+
+net_api_declare wowarmory => (
+    base_url    => 'http://eu.wowarmory.com/',
+    format      => 'xml',
+    format_mode => 'append',
+    useragent   => sub {
+        my $ua = LWP::UserAgent->new;
+        $ua->agent(
+            "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"
+        );
+        return $ua;
+    },
+);
+
+net_api_method character => (
+    method   => 'GET',
+    path     => '/character-sheet',
+    params   => [qw/r n/],
+    required => [qw/r n/],
+);
+1;