Modify agent unittest
This commit is contained in:
parent
c30f57ef12
commit
97929be581
@ -49,24 +49,24 @@ class TestUtils(unittest.TestCase):
|
|||||||
# test centos 6.5
|
# test centos 6.5
|
||||||
platform.linux_distribution = mock.Mock(return_value=['', '6.5', ''])
|
platform.linux_distribution = mock.Mock(return_value=['', '6.5', ''])
|
||||||
out = ['eth0 Link encap:Ethernet HWaddr FA:16:3E:61:F2:CF',
|
out = ['eth0 Link encap:Ethernet HWaddr FA:16:3E:61:F2:CF',
|
||||||
'inet addr:10.0.1.104 Bcast:10.0.1.255 Mask:255.255.255.0'
|
'inet addr:10.0.1.104 Bcast:10.0.1.255 Mask:255.255.255.0',
|
||||||
'inet6 addr: fe80::f816:3eff:fe61:f2cf/64 Scope:Link'
|
'inet6 addr: fe80::f816:3eff:fe61:f2cf/64 Scope:Link',
|
||||||
'UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1'
|
'UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1',
|
||||||
'RX packets:20121 errors:0 dropped:0 overruns:0 frame:0'
|
'RX packets:20121 errors:0 dropped:0 overruns:0 frame:0',
|
||||||
'TX packets:10163 errors:0 dropped:0 overruns:0 carrier:0'
|
'TX packets:10163 errors:0 dropped:0 overruns:0 carrier:0',
|
||||||
'collisions:0 txqueuelen:1000'
|
'collisions:0 txqueuelen:1000',
|
||||||
'RX bytes:19492218 (18.5 MiB) TX bytes:1173768 (1.1 MiB)']
|
'RX bytes:19492218 (18.5 MiB) TX bytes:1173768 (1.1 MiB)']
|
||||||
utils.execute = mock.Mock(return_value=(0, out))
|
utils.execute = mock.Mock(return_value=(0, out))
|
||||||
self.assertEqual(utils.get_interface('eth0')[0], 0)
|
self.assertEqual(utils.get_interface('eth0')[0], 0)
|
||||||
# test centos 7.0
|
# test centos 7.0
|
||||||
platform.linux_distribution = mock.Mock(return_value=['', '7.0', ''])
|
platform.linux_distribution = mock.Mock(return_value=['', '7.0', ''])
|
||||||
out = ['eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500'
|
out = ['eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500',
|
||||||
'inet 10.0.1.101 netmask 255.255.255.0 broadcast 10.0.1.255'
|
'inet 10.0.1.101 netmask 255.255.255.0 broadcast 10.0.1.255',
|
||||||
'inet6 fe80::f816:3eff:fe6f:1a9d prefixlen 64 scopeid 0x20<l'
|
'inet6 fe80::f816:3eff:fe6f:1a9d prefixlen 64 scopeid 0x20<l',
|
||||||
'ether fa:16:3e:6f:1a:9d txqueuelen 1000 (Ethernet)'
|
'ether fa:16:3e:6f:1a:9d txqueuelen 1000 (Ethernet)',
|
||||||
'RX packets 415365 bytes 150440678 (143.4 MiB)'
|
'RX packets 415365 bytes 150440678 (143.4 MiB)',
|
||||||
'RX errors 0 dropped 0 overruns 0 frame 0'
|
'RX errors 0 dropped 0 overruns 0 frame 0',
|
||||||
'TX packets 275332 bytes 91891644 (87.6 MiB)'
|
'TX packets 275332 bytes 91891644 (87.6 MiB)',
|
||||||
'TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0']
|
'TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0']
|
||||||
utils.execute = mock.Mock(return_value=(0, out))
|
utils.execute = mock.Mock(return_value=(0, out))
|
||||||
self.assertEqual(utils.get_interface('eth0')[0], 0)
|
self.assertEqual(utils.get_interface('eth0')[0], 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user