[Fusioninventory-commit] [fusinv/fusioninventory-agent-task-snmpquery] 145d02: initial import
Guillaume Rousse
guillomovitch at gmail.com
Wed Apr 25 17:20:16 UTC 2012
Branch: refs/heads/master
Home: https://github.com/fusinv/fusioninventory-agent-task-snmpquery
Commit: 145d0286d1ee894a0264956ed3baf66c1222afd5
https://github.com/fusinv/fusioninventory-agent-task-snmpquery/commit/145d0286d1ee894a0264956ed3baf66c1222afd5
Author: Guillaume Rousse <guillomovitch at gmail.com>
Date: 2012-04-25 (Wed, 25 Apr 2012)
Changed paths:
A t/output.t
Log Message:
-----------
initial import
diff --git a/t/output.t b/t/output.t
new file mode 100644
index 0000000..6aaf1b4
--- /dev/null
+++ b/t/output.t
@@ -0,0 +1,101 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+use FusionInventory::Agent::XML::Query;
+
+# each item is an arrayref of three elements:
+# - input data structure
+# - expected xml output
+# - test explication
+my @tests = (
+ [
+ {
+ PORTS => {
+ PORT => [
+ {
+ CONNECTIONS => {
+ CONNECTION => {
+ MAC => [
+ '00:00:74:D2:09:6A',
+ ]
+ }
+ }
+ },
+ ]
+ }
+ },
+ <<EOF,
+<?xml version="1.0" encoding="UTF-8" ?>
+<REQUEST>
+ <CONTENT>
+ <PORTS>
+ <PORT>
+ <CONNECTIONS>
+ <CONNECTION>
+ <MAC>00:00:74:D2:09:6A</MAC>
+ </CONNECTION>
+ </CONNECTIONS>
+ </PORT>
+ </PORTS>
+ </CONTENT>
+ <DEVICEID>foobar</DEVICEID>
+ <QUERY>SNMPQUERY</QUERY>
+</REQUEST>
+EOF
+ 'single mac address'
+ ],
+ [
+ {
+ PORTS => {
+ PORT => [
+ {
+ CONNECTIONS => {
+ CONNECTION => {
+ MAC => [
+ '00:00:74:D2:09:6A',
+ '00:00:74:D2:09:6B'
+ ]
+ }
+ }
+ },
+ ]
+ }
+ },
+ <<EOF,
+<?xml version="1.0" encoding="UTF-8" ?>
+<REQUEST>
+ <CONTENT>
+ <PORTS>
+ <PORT>
+ <CONNECTIONS>
+ <CONNECTION>
+ <MAC>00:00:74:D2:09:6A</MAC>
+ <MAC>00:00:74:D2:09:6B</MAC>
+ </CONNECTION>
+ </CONNECTIONS>
+ </PORT>
+ </PORTS>
+ </CONTENT>
+ <DEVICEID>foobar</DEVICEID>
+ <QUERY>SNMPQUERY</QUERY>
+</REQUEST>
+EOF
+ 'multiple mac addresses'
+ ],
+);
+
+plan tests => scalar @tests;
+
+foreach my $test (@tests) {
+ my $message = FusionInventory::Agent::XML::Query->new(
+ deviceid => 'foobar',
+ query => 'SNMPQUERY',
+ content => $test->[0]
+ );
+ is($message->getContent(), $test->[1], $test->[2]);
+}
+
+
================================================================
Commit: 69b32e09718736f379f351bd592f106c96b5c45f
https://github.com/fusinv/fusioninventory-agent-task-snmpquery/commit/69b32e09718736f379f351bd592f106c96b5c45f
Author: Guillaume Rousse <guillomovitch at gmail.com>
Date: 2012-04-25 (Wed, 25 Apr 2012)
Changed paths:
M t/cisco.t
M t/procurve.t
Log Message:
-----------
better comments
diff --git a/t/cisco.t b/t/cisco.t
index 19e3e41..7409a98 100755
--- a/t/cisco.t
+++ b/t/cisco.t
@@ -6,11 +6,11 @@ use warnings;
use Test::More;
use FusionInventory::Agent::Task::NetInventory::Manufacturer::Cisco;
+# each item is an arrayref of three elements:
+# - input data structure (ports list)
+# - expected resulting data structure
+# - test explication
my @devices_mac_addresses_tests = (
- # each item is an arrayref of three elements:
- # - input ports list
- # - output ports list
- # - test explication
[
{
0 => {
@@ -65,11 +65,11 @@ my @devices_mac_addresses_tests = (
],
);
+# each item is an arrayref of three elements:
+# - input data structure (ports list)
+# - expected resulting data structure
+# - test explication
my @devices_tests = (
- # each item is an arrayref of three elements:
- # - input ports list
- # - output ports list
- # - test explication
[
{},
{
diff --git a/t/procurve.t b/t/procurve.t
index c988d03..3ce8bf2 100755
--- a/t/procurve.t
+++ b/t/procurve.t
@@ -6,11 +6,11 @@ use warnings;
use Test::More;
use FusionInventory::Agent::Task::NetInventory::Manufacturer::Procurve;
+# each item is an arrayref of three elements:
+# - input data structure (ports list)
+# - expected resulting data structure
+# - test explication
my @devices_mac_addresses_tests = (
- # each item is an arrayref of three elements:
- # - input ports list
- # - output ports list
- # - test explication
[
{
52 => {
================================================================
Commit: c9f1edca13b40d640d5b1d89970744f28d3ca254
https://github.com/fusinv/fusioninventory-agent-task-snmpquery/commit/c9f1edca13b40d640d5b1d89970744f28d3ca254
Author: Guillaume Rousse <guillomovitch at gmail.com>
Date: 2012-04-25 (Wed, 25 Apr 2012)
Changed paths:
M lib/FusionInventory/Agent/Task/NetInventory/Manufacturer/3Com.pm
Log Message:
-----------
test earlier, test better
diff --git a/lib/FusionInventory/Agent/Task/NetInventory/Manufacturer/3Com.pm b/lib/FusionInventory/Agent/Task/NetInventory/Manufacturer/3Com.pm
index 4e71f70..3176816 100644
--- a/lib/FusionInventory/Agent/Task/NetInventory/Manufacturer/3Com.pm
+++ b/lib/FusionInventory/Agent/Task/NetInventory/Manufacturer/3Com.pm
@@ -33,12 +33,12 @@ sub setConnectedDevicesMacAddress {
$mac = alt2canonical($mac);
+ # This mac is empty
+ next unless $mac;
+
# this is port own mac address
next if $port->{MAC} && $port->{MAC} eq $mac;
- # This mac is empty
- next if $mac eq '';
-
# create a new connection with this mac address
push
@{$port->{CONNECTIONS}->{CONNECTION}->{MAC}},
================================================================
Compare: https://github.com/fusinv/fusioninventory-agent-task-snmpquery/compare/1fb2024...c9f1edc
More information about the Fusioninventory-commit
mailing list