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)]
|
||||
mod test {
|
||||
use std::{thread, time::Duration};
|
||||
// #[cfg(test)]
|
||||
// mod test {
|
||||
// use std::{thread, time::Duration};
|
||||
|
||||
use super::*;
|
||||
// use super::*;
|
||||
|
||||
use anyhow::Result;
|
||||
// use anyhow::Result;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_connection() -> Result<()> {
|
||||
let dev = Tasmota::new("Tasmota-Plug-1");
|
||||
// #[tokio::test]
|
||||
// async fn test_connection() -> Result<()> {
|
||||
// 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]
|
||||
async fn test_toggle() -> Result<()> {
|
||||
let dev = Tasmota::new("Tasmota-Plug-4");
|
||||
// #[tokio::test]
|
||||
// async fn test_toggle() -> Result<()> {
|
||||
// let dev = Tasmota::new("Tasmota-Plug-4");
|
||||
|
||||
dev.switch_off().await?;
|
||||
assert_eq!(dev.power_state().await?, false);
|
||||
// dev.switch_off().await?;
|
||||
// assert_eq!(dev.power_state().await?, false);
|
||||
|
||||
thread::sleep(Duration::from_secs(5));
|
||||
// thread::sleep(Duration::from_secs(5));
|
||||
|
||||
dev.switch_on().await?;
|
||||
assert_eq!(dev.power_state().await?, true);
|
||||
// dev.switch_on().await?;
|
||||
// assert_eq!(dev.power_state().await?, true);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_led() -> Result<()> {
|
||||
let dev = Tasmota::new("Tasmota-Plug-4");
|
||||
// #[tokio::test]
|
||||
// async fn test_led() -> Result<()> {
|
||||
// let dev = Tasmota::new("Tasmota-Plug-4");
|
||||
|
||||
dev.turn_off_led().await?;
|
||||
assert_eq!(dev.led_state().await?, false);
|
||||
// dev.turn_off_led().await?;
|
||||
// assert_eq!(dev.led_state().await?, false);
|
||||
|
||||
thread::sleep(Duration::from_secs(5));
|
||||
// thread::sleep(Duration::from_secs(5));
|
||||
|
||||
dev.turn_on_led().await?;
|
||||
assert_eq!(dev.led_state().await?, true);
|
||||
// dev.turn_on_led().await?;
|
||||
// assert_eq!(dev.led_state().await?, true);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
// Ok(())
|
||||
// }
|
||||
// }
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Deserialize, Debug)]
|
||||
|
|
|
@ -130,20 +130,20 @@ impl TibberHandler {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::TibberHandler;
|
||||
use anyhow::Result;
|
||||
// #[cfg(test)]
|
||||
// mod test {
|
||||
// use super::TibberHandler;
|
||||
// use anyhow::Result;
|
||||
|
||||
use std::fs;
|
||||
// use std::fs;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_connection() -> Result<()> {
|
||||
let tibber = TibberHandler::new(fs::read_to_string("tibber_token.txt")?).await?;
|
||||
let current_prices = tibber.current_prices().await?;
|
||||
// #[tokio::test]
|
||||
// async fn test_connection() -> Result<()> {
|
||||
// let tibber = TibberHandler::new(fs::read_to_string("tibber_token.txt")?).await?;
|
||||
// let current_prices = tibber.current_prices().await?;
|
||||
|
||||
println!("{current_prices:?}");
|
||||
// println!("{current_prices:?}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
// Ok(())
|
||||
// }
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue