Comment tasmota and tibber tests
This commit is contained in:
parent
5ac8f22c2d
commit
63fa933ad9
2 changed files with 46 additions and 46 deletions
|
@ -96,55 +96,55 @@ impl Tasmota {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
// #[cfg(test)]
|
||||||
mod test {
|
// mod test {
|
||||||
use std::{thread, time::Duration};
|
// use std::{thread, time::Duration};
|
||||||
|
|
||||||
use super::*;
|
// use super::*;
|
||||||
|
|
||||||
use anyhow::Result;
|
// use anyhow::Result;
|
||||||
|
|
||||||
#[tokio::test]
|
// #[tokio::test]
|
||||||
async fn test_connection() -> Result<()> {
|
// async fn test_connection() -> Result<()> {
|
||||||
let dev = Tasmota::new("Tasmota-Plug-1");
|
// let dev = Tasmota::new("Tasmota-Plug-1");
|
||||||
|
|
||||||
let power = dev.read_power_usage().await?;
|
// let power = dev.read_power_usage().await?;
|
||||||
|
|
||||||
println!("{power}");
|
// println!("{power}");
|
||||||
|
|
||||||
Ok(())
|
// Ok(())
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[tokio::test]
|
// #[tokio::test]
|
||||||
async fn test_toggle() -> Result<()> {
|
// async fn test_toggle() -> Result<()> {
|
||||||
let dev = Tasmota::new("Tasmota-Plug-4");
|
// let dev = Tasmota::new("Tasmota-Plug-4");
|
||||||
|
|
||||||
dev.switch_off().await?;
|
// dev.switch_off().await?;
|
||||||
assert_eq!(dev.power_state().await?, false);
|
// assert_eq!(dev.power_state().await?, false);
|
||||||
|
|
||||||
thread::sleep(Duration::from_secs(5));
|
// thread::sleep(Duration::from_secs(5));
|
||||||
|
|
||||||
dev.switch_on().await?;
|
// dev.switch_on().await?;
|
||||||
assert_eq!(dev.power_state().await?, true);
|
// assert_eq!(dev.power_state().await?, true);
|
||||||
|
|
||||||
Ok(())
|
// Ok(())
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[tokio::test]
|
// #[tokio::test]
|
||||||
async fn test_led() -> Result<()> {
|
// async fn test_led() -> Result<()> {
|
||||||
let dev = Tasmota::new("Tasmota-Plug-4");
|
// let dev = Tasmota::new("Tasmota-Plug-4");
|
||||||
|
|
||||||
dev.turn_off_led().await?;
|
// dev.turn_off_led().await?;
|
||||||
assert_eq!(dev.led_state().await?, false);
|
// assert_eq!(dev.led_state().await?, false);
|
||||||
|
|
||||||
thread::sleep(Duration::from_secs(5));
|
// thread::sleep(Duration::from_secs(5));
|
||||||
|
|
||||||
dev.turn_on_led().await?;
|
// dev.turn_on_led().await?;
|
||||||
assert_eq!(dev.led_state().await?, true);
|
// assert_eq!(dev.led_state().await?, true);
|
||||||
|
|
||||||
Ok(())
|
// Ok(())
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
|
|
|
@ -130,20 +130,20 @@ impl TibberHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
// #[cfg(test)]
|
||||||
mod test {
|
// mod test {
|
||||||
use super::TibberHandler;
|
// use super::TibberHandler;
|
||||||
use anyhow::Result;
|
// use anyhow::Result;
|
||||||
|
|
||||||
use std::fs;
|
// use std::fs;
|
||||||
|
|
||||||
#[tokio::test]
|
// #[tokio::test]
|
||||||
async fn test_connection() -> Result<()> {
|
// async fn test_connection() -> Result<()> {
|
||||||
let tibber = TibberHandler::new(fs::read_to_string("tibber_token.txt")?).await?;
|
// let tibber = TibberHandler::new(fs::read_to_string("tibber_token.txt")?).await?;
|
||||||
let current_prices = tibber.current_prices().await?;
|
// let current_prices = tibber.current_prices().await?;
|
||||||
|
|
||||||
println!("{current_prices:?}");
|
// println!("{current_prices:?}");
|
||||||
|
|
||||||
Ok(())
|
// Ok(())
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
Loading…
Reference in a new issue