Code formatting
Rust Build / Test Suite (pull_request) Successful in 36s
Rust Build / Check (pull_request) Successful in 51s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / build (pull_request) Successful in 1m42s
Rust Build / Clippy (pull_request) Successful in 2m9s
Rust Build / Test Suite (pull_request) Successful in 36s
Rust Build / Check (pull_request) Successful in 51s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / build (pull_request) Successful in 1m42s
Rust Build / Clippy (pull_request) Successful in 2m9s
This commit is contained in:
+17
-10
@@ -115,13 +115,6 @@ pub mod requests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_demo() {
|
||||
let i = 0;
|
||||
|
||||
assert_eq!(0, i, "Values should match {} {}", 0, 1);
|
||||
}
|
||||
|
||||
const TEST_FIRSTNAME: &str = "Billy";
|
||||
const TEST_LASTNAME: &str = "Bob";
|
||||
const TEST_USERNAME: &str = "BillyBob01";
|
||||
@@ -134,7 +127,10 @@ async fn register_user(
|
||||
match requests::register_user(&app).await {
|
||||
Ok(response) => {
|
||||
if axum::http::StatusCode::CREATED != response.status() {
|
||||
Err(std::io::Error::other(""))
|
||||
Err(std::io::Error::other(format!(
|
||||
"Status code is off {:?}",
|
||||
response.status()
|
||||
)))
|
||||
} else {
|
||||
match axum::body::to_bytes(response.into_body(), usize::MAX).await {
|
||||
Ok(body) => {
|
||||
@@ -158,7 +154,10 @@ async fn login_user(
|
||||
match requests::login_user(&app, username, password).await {
|
||||
Ok(response) => {
|
||||
if axum::http::StatusCode::OK != response.status() {
|
||||
Err(std::io::Error::other(""))
|
||||
Err(std::io::Error::other(format!(
|
||||
"Status code is off {:?}",
|
||||
response.status()
|
||||
)))
|
||||
} else {
|
||||
match axum::body::to_bytes(response.into_body(), usize::MAX).await {
|
||||
Ok(body) => {
|
||||
@@ -207,6 +206,8 @@ async fn test_register_user() {
|
||||
.unwrap();
|
||||
let parsed_body: callers::register::response::Response =
|
||||
serde_json::from_slice(&body).unwrap();
|
||||
assert!(parsed_body.data.len() > 0, "No data returned");
|
||||
|
||||
let returned_user = &parsed_body.data[0];
|
||||
|
||||
assert_eq!(
|
||||
@@ -249,7 +250,13 @@ async fn test_login_user() {
|
||||
|
||||
match register_user(&app).await {
|
||||
Ok(user) => match login_user(&app, &user.username, TEST_PASSWORD).await {
|
||||
Ok(_login_result) => {}
|
||||
Ok(login_result) => {
|
||||
assert_eq!(
|
||||
false,
|
||||
login_result.access_token.is_empty(),
|
||||
"Access token is empty when it should not be"
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
assert!(false, "Error: {err:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user