'Tests is_interface_valid when the adapter is required as monitor but
is managed by NetworkManager'

def test_is_interface_valid_mode_monitor_is_managed_by_nm_error(self):

    interface_name = 'wlan0'
    adapter = interfaces.NetworkAdapter(interface_name, 'CARD', '00:00:00:00:00:00')
    adapter.is_managed_by_nm = True
    adapter.has_monitor_mode = True
    self.network_manager._name_to_object[interface_name] = adapter
    with self.assertRaises(interfaces.InterfaceManagedByNetworkManagerError):
        self.network_manager.is_interface_valid(interface_name, 'monitor')
