File: 04purge.t

package info (click to toggle)
libnet-akamai-perl 0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 204 kB
  • ctags: 160
  • sloc: perl: 2,317; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (2)
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
37
38
39
40
#!/usr/bin/perl -w
use strict;
use warnings;

# to validly test this module you must set these env vars
#NET_AKAMAI_USERNAME -- akamai username with purge access
#NET_AKAMAI_PASSWORD -- akamai password
#NET_AKAMAI_EMAIL -- email to send purge results
#NET_AKAMAI_TESTURL -- a url test to test the purge

use Test::More;

unless ($ENV{NET_AKAMAI_USERNAME} && $ENV{NET_AKAMAI_PASSWORD}
	&& $ENV{NET_AKAMAI_EMAIL} && $ENV{NET_AKAMAI_TESTURL}) {
	plan skip_all => 'set NET_AKAMAI_USERNAME, NET_AKAMAI_PASSWORD, NET_AKAMAI_EMAIL, NET_AKAMAI_TESTURL to enable this test';
}

use_ok( 'Net::Akamai' );

my $data = new Net::Akamai::RequestData(
	user  => $ENV{NET_AKAMAI_USERNAME},
	pwd   => $ENV{NET_AKAMAI_PASSWORD},
	email => $ENV{NET_AKAMAI_EMAIL},
);
isa_ok($data, 'Net::Akamai::RequestData');

my $ap = new Net::Akamai(req_data=>$data);
isa_ok($ap, 'Net::Akamai');

$ap->add_url( $ENV{NET_AKAMAI_TESTURL} );

my $res = $ap->purge();

ok( $res->successful(), 'purge was successful' );

if (!$res->successful()) {
    diag "$res";
}

done_testing;