summaryrefslogtreecommitdiffstats
path: root/src/tests/fakes/fake_input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/fakes/fake_input.rs')
-rw-r--r--src/tests/fakes/fake_input.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tests/fakes/fake_input.rs b/src/tests/fakes/fake_input.rs
index f267b48..146a85e 100644
--- a/src/tests/fakes/fake_input.rs
+++ b/src/tests/fakes/fake_input.rs
@@ -7,6 +7,7 @@ use std::{
use async_trait::async_trait;
use crossterm::event::Event;
use ipnetwork::IpNetwork;
+use itertools::Itertools;
use pnet::datalink::{DataLinkReceiver, NetworkInterface};
use tokio::runtime::Runtime;
@@ -159,6 +160,12 @@ pub fn get_interfaces() -> Vec<NetworkInterface> {
}]
}
+pub fn get_interfaces_with_frames(
+ frames: impl IntoIterator<Item = Box<dyn DataLinkReceiver>>,
+) -> Vec<(NetworkInterface, Box<dyn DataLinkReceiver>)> {
+ get_interfaces().into_iter().zip_eq(frames).collect()
+}
+
pub fn create_fake_dns_client(ips_to_hosts: HashMap<IpAddr, String>) -> Option<dns::Client> {
let runtime = Runtime::new().unwrap();
let dns_client = dns::Client::new(FakeResolver(ips_to_hosts), runtime).unwrap();