### ----------------------------------------------------
### -- Shodan
### -- Licenses: Artistic-2.0
### -- Authors: Sarah Fuller
### -- File: t/03-scanning.rakutest
### ----------------------------------------------------
use Test;
use Shodan;

plan :skip-all<Author tests not required for installation> unless (%*ENV{'SHODAN_TESTING'});
plan 6;

my $shodan = Shodan.new(api-key => %*ENV{'SHODAN_API_KEY'});

isa-ok($shodan.ports, 'Array', '.ports');

isa-ok($shodan.protocols, 'Hash', '.protocols');

isa-ok($shodan.scan(ips => '8.8.8.8,1.1.1.1'), 'Hash', '.scan without service var');

isa-ok($shodan.scan(ips => '8.8.8.8,1.1.1.1', service => [[53, 'dns-udp'], [443, 'https']]), 'Hash', '.scan with service var');

# Do not have enterprise account to test this.
#isa-ok($shodan.scan-internet(port => 80, protocol => 'http'), 'Hash', '.scan-internet');

my $scan;
isa-ok($scan = $shodan.scans, 'Hash', '.scans');

isa-ok($shodan.scan-status(id => $scan{'matches'}[0]{'id'}), 'Hash', '.scan-status');

done-testing;


