-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mod models; | ||
pub mod models; | ||
pub mod py_bindings; | ||
use models::devices; | ||
use models::rbody::{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use hwlib::get_certification_status; | ||
use hwlib::models::rbody::CertificationStatusResponse; | ||
|
||
const SERVER_URL: &str = "https://example.com"; | ||
|
||
#[tokio::test] | ||
async fn test_get_certification_status_not_seen() { | ||
std::env::set_var("CERTIFICATION_STATUS", "0"); | ||
let response = get_certification_status(SERVER_URL).await.unwrap(); | ||
assert!(matches!(response, CertificationStatusResponse::NotSeen(_))); | ||
std::env::remove_var("CERTIFICATION_STATUS"); | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_get_certification_status_partially_certified() { | ||
std::env::set_var("CERTIFICATION_STATUS", "1"); | ||
let response = get_certification_status(SERVER_URL).await.unwrap(); | ||
assert!(matches!( | ||
response, | ||
CertificationStatusResponse::RelatedCertifiedSystemExists(_) | ||
)); | ||
std::env::remove_var("CERTIFICATION_STATUS"); | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_get_certification_status_certified() { | ||
std::env::set_var("CERTIFICATION_STATUS", "2"); | ||
let response = get_certification_status(SERVER_URL).await.unwrap(); | ||
assert!(matches!( | ||
response, | ||
CertificationStatusResponse::Certified(_) | ||
)); | ||
std::env::remove_var("CERTIFICATION_STATUS"); | ||
} |