Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderManich committed Nov 28, 2023
1 parent 043a0d0 commit 90d2af4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
19 changes: 1 addition & 18 deletions src/tests/api/model_logic.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use mockall::predicate;
use sea_orm::DbErr;
use tonic::{Code, Request};

use crate::{
api::server::server::{ecdar_api_server::EcdarApi, ComponentsInfo, GetModelRequest},
api::server::server::{ecdar_api_server::EcdarApi, GetModelRequest},
entities::{access, in_use, model, query},
tests::api::helpers::{get_mock_concrete_ecdar_api, get_mock_services},
};
Expand Down Expand Up @@ -263,22 +262,6 @@ async fn get_model_model_has_no_queries_queries_are_empty() {
latest_activity: Default::default(),
};

let query1 = query::Model {
id: 0,
model_id: 1,
string: "query".to_owned(),
result: None,
outdated: false,
};

let query2 = query::Model {
id: 1,
model_id: 1,
string: "query".to_owned(),
result: Some(serde_json::to_value("result").unwrap()),
outdated: false,
};

let queries: Vec<query::Model> = vec![];

mock_services
Expand Down
14 changes: 14 additions & 0 deletions src/tests/database/access_context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[cfg(test)]
mod database_tests {
use crate::database::access_context::AccessContextTrait;
use crate::tests::database::helpers::{
create_accesses, create_models, create_users, get_reset_database_context,
};
Expand Down Expand Up @@ -345,4 +346,17 @@ mod database_tests {
DbErr::RecordNotFound(_)
));
}

#[tokio::test]
async fn get_by_uid_and_model_id_test() {
let (access_context, expected_access, user, model) = seed_db().await;

let access = access_context
.get_access_by_uid_and_model_id(user.id, model.id)
.await;

dbg!(&expected_access, &access, user, model);

assert!(access.unwrap().unwrap() == expected_access);
}
}

0 comments on commit 90d2af4

Please sign in to comment.