mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-13 03:22:29 +00:00
fix(api): whoami test
This commit is contained in:
parent
c78a5f5258
commit
367fc9ffe6
2 changed files with 8 additions and 5 deletions
|
|
@ -2,7 +2,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
|||
|
||||
use portfolio_core::Query;
|
||||
use portfolio_core::models::auth::AuthenticableTrait;
|
||||
use portfolio_core::models::candidate::{ApplicationDetails, BaseCandidateResponse, NewCandidateResponse};
|
||||
use portfolio_core::models::candidate::{ApplicationDetails, NewCandidateResponse};
|
||||
use portfolio_core::sea_orm::prelude::Uuid;
|
||||
use portfolio_core::services::application_service::ApplicationService;
|
||||
use portfolio_core::services::candidate_service::CandidateService;
|
||||
|
|
@ -258,7 +258,7 @@ pub async fn download_portfolio(session: CandidateAuth) -> Result<Vec<u8>, Custo
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use portfolio_core::{crypto, models::candidate::ApplicationDetails, sea_orm::prelude::Uuid};
|
||||
use portfolio_core::{crypto, models::candidate::{ApplicationDetails, NewCandidateResponse}, sea_orm::prelude::Uuid};
|
||||
use rocket::{
|
||||
http::{Cookie, Status},
|
||||
local::blocking::Client,
|
||||
|
|
@ -266,7 +266,7 @@ mod tests {
|
|||
|
||||
use crate::{
|
||||
routes::admin::tests::admin_login,
|
||||
test::tests::{test_client, APPLICATION_ID, CANDIDATE_PASSWORD},
|
||||
test::tests::{test_client, APPLICATION_ID, CANDIDATE_PASSWORD, PERSONAL_ID_NUMBER},
|
||||
};
|
||||
|
||||
fn candidate_login(client: &Client) -> (Cookie, Cookie) {
|
||||
|
|
@ -328,7 +328,10 @@ mod tests {
|
|||
.dispatch();
|
||||
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
assert_eq!(response.into_string().unwrap(), APPLICATION_ID.to_string());
|
||||
|
||||
let candidate = response.into_json::<NewCandidateResponse>().unwrap();
|
||||
assert_eq!(candidate.application_id, APPLICATION_ID);
|
||||
assert_eq!(candidate.personal_id_number, PERSONAL_ID_NUMBER);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::{error::ServiceError, database::query::candidate::CandidateResult, se
|
|||
use super::candidate_details::decrypt_if_exists;
|
||||
|
||||
/// Minimal candidate response containing database only not null fields
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct NewCandidateResponse {
|
||||
pub application_id: i32,
|
||||
|
|
|
|||
Loading…
Reference in a new issue