Skip to content

Commit b4eb092

Browse files
committed
Add tests for fetch_oui_from_custom
1 parent fd57329 commit b4eb092

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ README.pod
1212
t/compile.t
1313
t/extract_oui_from_html.t
1414
t/fetch_oui.t
15+
t/fetch_oui_from_custom.t
1516
t/fetch_oui_from_ieee.t
1617
t/load_cache.t
1718
t/normalize_mac.t

t/fetch_oui_from_custom.t

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use Test::More 0.98;
2+
3+
use Data::Dumper;
4+
my $class = 'Net::MAC::Vendor';
5+
6+
diag( "Some tests have to fetch data files and can take a long time" );
7+
8+
subtest setup => sub {
9+
use_ok( $class );
10+
ok( defined &{"${class}::fetch_oui_from_custom"}, "&fetch_oui_from_custom is defined" );
11+
};
12+
13+
subtest fetch => sub {
14+
my $i = 0;
15+
for my $url (undef, 'http://standards.ieee.org/cgi-bin/ouisearch?14-10-9F', undef) {
16+
if ($i > 1) { $ENV{NET_MAC_VENDOR_OUI_SOURCE} =
17+
'http://standards.ieee.org/cgi-bin/ouisearch?14-10-9F' };
18+
my $array = Net::MAC::Vendor::fetch_oui_from_custom( '14:10:9F', $url );
19+
20+
SKIP: {
21+
skip "Couldn't fetch data, which happens, so no big whoop", 2
22+
unless defined $array;
23+
isa_ok( $array, ref [], "Got back array reference" );
24+
my $html = join "\n", @$array;
25+
like( $html, qr/Apple, Inc\./, "Fetched Apple's OUI entry" );
26+
}
27+
$i++;
28+
}
29+
};
30+
31+
done_testing();

t/test_manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pod_coverage.t
44
normalize_mac.t
55
oui.t
66
fetch_oui_from_ieee.t
7+
fetch_oui_from_custom.t
78
extract_oui_from_html.t
89
parse_oui.t
910
fetch_oui.t

0 commit comments

Comments
 (0)