Saving changes
All checks were successful
Rust Build / Check (pull_request) Successful in 41s
Rust Build / Test Suite (pull_request) Successful in 52s
Rust Build / Rustfmt (pull_request) Successful in 29s
Rust Build / Clippy (pull_request) Successful in 1m3s
Rust Build / build (pull_request) Successful in 1m19s
All checks were successful
Rust Build / Check (pull_request) Successful in 41s
Rust Build / Test Suite (pull_request) Successful in 52s
Rust Build / Rustfmt (pull_request) Successful in 29s
Rust Build / Clippy (pull_request) Successful in 1m3s
Rust Build / build (pull_request) Successful in 1m19s
This commit is contained in:
@@ -3,7 +3,27 @@ use axum::{Json, http::StatusCode};
|
|||||||
use crate::models;
|
use crate::models;
|
||||||
use crate::repo;
|
use crate::repo;
|
||||||
|
|
||||||
mod response {
|
pub mod request {
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Default, Deserialize, Serialize)]
|
||||||
|
pub struct Request {
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub username: String,
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub password: String,
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub email: String,
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub phone: String,
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub firstname: String,
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub lastname: String,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod response {
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::models;
|
use crate::models;
|
||||||
|
15
src/main.rs
15
src/main.rs
@@ -191,10 +191,9 @@ mod tests {
|
|||||||
|
|
||||||
let app = init::routes().await.layer(axum::Extension(pool));
|
let app = init::routes().await.layer(axum::Extension(pool));
|
||||||
|
|
||||||
let usr = icarus_auth::models::common::CreateUser {
|
let mut usr = icarus_auth::callers::register::request::Request::default();
|
||||||
username: String::from("somethingsss"),
|
usr.username = String::from("somethingsss");
|
||||||
password: String::from("Raindown!"),
|
usr.password = String::from("Raindown!");
|
||||||
};
|
|
||||||
|
|
||||||
let payload = json!({
|
let payload = json!({
|
||||||
"username": &usr.username,
|
"username": &usr.username,
|
||||||
@@ -214,7 +213,13 @@ mod tests {
|
|||||||
|
|
||||||
match response {
|
match response {
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
assert_eq!(resp.status(), StatusCode::CREATED, "Message: {:?}", resp);
|
assert_eq!(
|
||||||
|
resp.status(),
|
||||||
|
StatusCode::CREATED,
|
||||||
|
"Message: {:?} {:?}",
|
||||||
|
resp,
|
||||||
|
usr.username
|
||||||
|
);
|
||||||
let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
|
let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
Reference in New Issue
Block a user