Exemple #1
0
    def test_bridge_forward_delay(self):
        """Test reading of bridge forward-delay setting.
        """
        mock_handle = io.open.return_value
        mock_handle.read.return_value = '42\n'

        res = netdev.bridge_forward_delay('foo')

        io.open.assert_called_with('/sys/class/net/foo/bridge/forward_delay')
        self.assertEqual(res, 42)
Exemple #2
0
    def test_bridge_forward_delay(self, mock_open):
        """Test reading of bridge forward-delay setting.
        """
        mock_file = mock_open.return_value
        mock_filectx = mock_file.__enter__.return_value
        mock_filectx.read.return_value = '42\n'

        res = netdev.bridge_forward_delay('foo')

        mock_open.assert_called_with('/sys/class/net/foo/bridge/forward_delay')
        self.assertEqual(res, 42)