Disable tests since we have no current test account
[Net-XRC.git] / t / Net-XRC.t
1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl Net-XRC.t'
3
4 #########################
5
6 # change 'tests => 1' to 'tests => last_test_to_print';
7
8 #use Test;
9 #BEGIN { plan tests => 3 };
10
11 #use Test::More tests => 17;
12 use Test::More skip_all => 'test account no longer valid';
13 BEGIN{ use_ok('Net::XRC', qw(:types)) }
14
15 #########################
16
17 # Insert your test code below, the Test::More module is use()ed here so read
18 # its man page ( perldoc Test::More ) for help writing this test script.
19
20   $Net::XRC::DEBUG = 0;
21
22   my $clientID = '1551978';
23   my $password = 'password';
24
25   my $xrc = new Net::XRC (
26     'clientID' => $clientID,
27     'password' => $password,
28   );
29
30   my $domain = 'SISD.EVERY1.NET';
31
32   # noop
33
34   my $res = $xrc->noop;
35   ok( $res->is_success, 'noop sucessful' )
36     or diag( $res->error );
37   ok( ! defined($res->content), 'noop returns undef' );
38
39   # lookupMXReadyClientIDByEmailDomain
40
41   $res = $xrc->lookupMXReadyClientIDByEmailDomain($domain);
42   ok( $res->is_success, 'lookupMXReadyClientIDByEmailDomain sucessful' )
43     or diag( $res->error );
44   my $domain_clientID = $res->content;
45   ok( $domain_clientID != -1, 'lookupMXReadyClientIDByEmailDomain' );
46
47   # isAccountName
48
49   my @set = ( 'a'..'z', '0'..'9' );
50   my $username = join('', map { $set[int(rand(scalar(@set)))] } ( 1..32 ) );
51   $res = $xrc->isAccountNameAvailable( $domain_clientID, $username );
52   ok( $res->is_success, 'isAccountName sucessful' )
53     or diag( $res->error );
54   ok( $res->content, 'isAccountName returns true' );
55
56   # isAccountName (numeric)
57
58   my @nset = ( '0'..'9' );
59   my $nusername = join('', map { $nset[int(rand(scalar(@nset)))] } ( 1..32 ) );
60   $res = $xrc->isAccountNameAvailable( $domain_clientID, string($nusername) );
61   ok( $res->is_success, 'isAccountName (numeric) sucessful' )
62     or diag( $res->error );
63   ok( $res->content, 'isAccountName (numeric) returns true' );
64
65   # createUser
66
67   $res = $xrc->createUser( $domain_clientID, [], $username, 'password' );
68   ok( $res->is_success, 'createUser sucessful' )
69     or diag( $res->error );
70   ok( $res->content, 'createUser returns uid' );
71
72   # createUser (numeric)
73
74   $res = $xrc->createUser( $domain_clientID, [], string($nusername), 'password' );
75   ok( $res->is_success, 'createUser (numeric) sucessful' )
76     or diag( $res->error );
77   ok( $res->content, 'createUser (numeric) returns uid' );
78
79
80   # setUserPassword 
81
82   $res = $xrc->setUserPassword ( $domain_clientID, $username, 'newpassword' );
83   ok( $res->is_success, 'setUserPassword sucessful' )
84     or diag( $res->error );
85
86   # suspendUser
87
88   $res = $xrc->suspendUser( $domain_clientID, $username );
89   ok( $res->is_success, 'suspendUser sucessful' )
90     or diag( $res->error );
91
92   # unsuspendUser
93
94   $res = $xrc->unsuspendUser( $domain_clientID, $username );
95   ok( $res->is_success, 'unsuspendUser sucessful' )
96     or diag( $res->error );
97
98
99   # deleteUser
100
101   $res = $xrc->deleteUser( $domain_clientID, $username );
102   ok( $res->is_success, 'deleteUser sucessful' )
103     or diag( $res->error );
104
105