~landscape/landscape-client/trunk

« back to all changes in this revision

Viewing changes to landscape/lib/tests/test_network.py

  • Committer: Alberto Donato
  • Date: 2012-08-23 07:27:54 UTC
  • mfrom: (572.1.2 hide-vlan-ifaces)
  • Revision ID: alberto.donato@canonical.com-20120823072754-3cvvi2ntzym17xua
Merged hide-vlan-ifaces [r=jseutter,tribaal] [f=1038422].

Skip VLAN interfaces and interface aliases from the list of interfaces displayed by landscape-sysinfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
                self.assertIn("MULTICAST", block)
45
45
 
46
46
    def test_skip_loopback(self):
47
 
        """The C{lo} interface is reported by L{get_active_device_info}."""
 
47
        """The C{lo} interface is not reported by L{get_active_device_info}."""
48
48
        device_info = get_active_device_info()
49
49
        interfaces = [i["interface"] for i in device_info]
50
50
        self.assertNotIn("lo", interfaces)
51
51
 
 
52
    def test_skip_vlan(self):
 
53
        """VLAN interfaces are not reported by L{get_active_device_info}."""
 
54
        mock_get_active_interfaces = self.mocker.replace(get_active_interfaces)
 
55
        mock_get_active_interfaces(ANY)
 
56
        self.mocker.passthrough(
 
57
            result_callback=lambda result: list(result) + ["eth0.1"])
 
58
        self.mocker.replay()
 
59
        device_info = get_active_device_info()
 
60
        interfaces = [i["interface"] for i in device_info]
 
61
        self.assertNotIn("eth0.1", interfaces)
 
62
 
 
63
    def test_skip_alias(self):
 
64
        """Interface aliases are not reported by L{get_active_device_info}."""
 
65
        mock_get_active_interfaces = self.mocker.replace(get_active_interfaces)
 
66
        mock_get_active_interfaces(ANY)
 
67
        self.mocker.passthrough(
 
68
            result_callback=lambda result: list(result) + ["eth0:foo"])
 
69
        self.mocker.replay()
 
70
        device_info = get_active_device_info()
 
71
        interfaces = [i["interface"] for i in device_info]
 
72
        self.assertNotIn("eth0:foo", interfaces)
 
73
 
52
74
    def test_duplicate_network_interfaces(self):
53
75
        """
54
76
        L{get_active_interfaces} doesn't return duplicate network interfaces.