File: 702bookmyname_ws_live.t

package info (click to toggle)
libnet-dri-perl 0.96-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 3,616 kB
  • ctags: 2,922
  • sloc: perl: 39,615; makefile: 2
file content (36 lines) | stat: -rwxr-xr-x 1,545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w

use Net::DRI;
use Test::More;

unless ($ENV{TEST_BOOKMYNAME_WS_LIVE_CLIENTID} && $ENV{TEST_BOOKMYNAME_WS_LIVE_CLIENTPASS})
{
 plan skip_all => 'Set $ENV{TEST_BOOKMYNAME_WS_LIVE_CLIENTID} and $ENV{TEST_BOOKMYNAME_WS_LIVE_CLIENTPASS} if you want (normally harmless) *live* tests for BookMyName';
} else
{
 plan tests => 4;
}

my $dri=Net::DRI->new(10);
$dri->add_registry('BookMyName');
$dri->target('BookMyName')->add_current_profile('p1','ws',{client_login=>$ENV{TEST_BOOKMYNAME_WS_LIVE_CLIENTID},client_password=>$ENV{TEST_BOOKMYNAME_WS_LIVE_CLIENTPASS}});

eval {
 my $rc=$dri->account_list_domains();
 diag('Got session ID '.$dri->transport()->session_data()->{id});
 is($rc->is_success(),1,'account_list_domains() is_success') or diag(sprintf('Code=%s Native_Code=%d Message=%s',$rc->code(),$rc->native_code(),$rc->message()));
 my $rd=$dri->get_info('list','account','domains');
 is(ref($rd),'ARRAY','get_info(list,account,domains)');
 diag('Successfully retrieved list of '.scalar(@$rd).' domain names: '.join(' ',@$rd));
 my $rd2=$dri->get_info('list');
 is_deeply($rd2,$rd,'get_info(list,account,domains) and get_info(list) give the same results');

 $rc=$dri->domain_info($rd->[0]);
 is($rc->is_success(),1,'domain_info() is_success') or diag(sprintf('Code=%s Native_Code=%d Message=%s',$rc->code(),$rc->native_code(),$rc->message()));
 my @i=$dri->get_info_keys();
 diag('Successfully got information about: '.join(' ',@i));
};

diag('Caught unexpected exception: '.(ref($@)? $@->as_string() : $@)) if $@;

exit 0;