Skip to content

Commit

Permalink
Merge pull request #29 from w6d-io/develop
Browse files Browse the repository at this point in the history
[ADD] disable opa
  • Loading branch information
nhaquet-w6d authored Nov 7, 2023
2 parents e36ba06 + 3da7492 commit 7cd72fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions src/controller/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub async fn update_controller(
let mut handles = JoinSet::new();
let mut object_identity: Option<Arc<Identity>> = None;
for data in payload.iter() {
if !validate_roles(
/* if !validate_roles(
&config,
&identity,
&data.ressource_id,
Expand All @@ -104,7 +104,7 @@ pub async fn update_controller(
.await?
{
Err(anyhow!("Invalid role!"))?;
}
} */
println!("role validated!");
match object_identity {
Some(ref ident) => {
Expand Down Expand Up @@ -202,19 +202,19 @@ pub mod test_controler {
.with_body(body)
.create_async()
.await;
let opa_mock = opa_server
/* let opa_mock = opa_server
.mock("post", "/")
.with_status(200)
.with_header("content-type", "application/json")
.with_body(r#"true"#)
.create_async()
.await;
.await; */
let identity = serde_json::from_str(IDENTITY_USER).unwrap();
update_controller(Arc::new(config), vec![data], uuid, identity)
.await
.unwrap();
kratos_mock.assert_async().await;
opa_mock.assert_async().await;
// opa_mock.assert_async().await;
}

#[tokio::test]
Expand All @@ -240,20 +240,20 @@ pub mod test_controler {
.with_body(body)
.create_async()
.await;
let opa_mock = opa_server
/* let opa_mock = opa_server
.mock("post", "/")
.with_status(200)
.with_header("content-type", "application/json")
.with_body(r#"true"#)
.expect(2)
.create_async()
.await;
.await; */

let identity = serde_json::from_str(IDENTITY_USER).unwrap();
update_controller(Arc::new(config), vec![data.clone(), data], uuid, identity)
.await
.unwrap();
kratos_mock.assert_async().await;
opa_mock.assert_async().await;
// opa_mock.assert_async().await;
}
}
18 changes: 9 additions & 9 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,13 @@ mod http_router_test {
.with_body(serde_json::to_string(&session).unwrap())
.create_async()
.await;
let opa_mock = opa_server
/* let opa_mock = opa_server
.mock("post", "/")
.with_status(200)
.with_header("content-type", "application/json")
.with_body(r#"true"#)
.create_async()
.await;
.await; */
let config = Arc::new(RwLock::new(config));
let app = app(config);
let response = app
Expand All @@ -372,7 +372,7 @@ mod http_router_test {
.unwrap();
kratos_mock_session.assert_async().await;
kratos_mock_admin.assert_async().await;
opa_mock.assert_async().await;
// opa_mock.assert_async().await;
assert_eq!(response.status(), StatusCode::OK);
}

Expand Down Expand Up @@ -402,13 +402,13 @@ mod http_router_test {
.with_body(serde_json::to_string(&session).unwrap())
.create_async()
.await;
let opa_mock = opa_server
/* let opa_mock = opa_server
.mock("post", "/")
.with_status(200)
.with_header("content-type", "application/json")
.with_body(r#"true"#)
.create_async()
.await;
.await; */
let config = Arc::new(RwLock::new(config));
let app = app(config);
let response = app
Expand All @@ -434,7 +434,7 @@ mod http_router_test {
.unwrap();
kratos_mock_session.assert_async().await;
kratos_mock_admin.assert_async().await;
opa_mock.assert_async().await;
// opa_mock.assert_async().await;
println!("{:#?}", response);
assert_eq!(response.status(), StatusCode::OK);
}
Expand Down Expand Up @@ -465,13 +465,13 @@ mod http_router_test {
.with_body(serde_json::to_string(&session).unwrap())
.create_async()
.await;
let opa_mock = opa_server
/* let opa_mock = opa_server
.mock("post", "/")
.with_status(200)
.with_header("content-type", "application/json")
.with_body(r#"true"#)
.create_async()
.await;
.await; */
let config = Arc::new(RwLock::new(config));
let app = app(config);
let response = app
Expand All @@ -497,7 +497,7 @@ mod http_router_test {
.unwrap();
kratos_mock_session.assert_async().await;
kratos_mock_admin.assert_async().await;
opa_mock.assert_async().await;
// opa_mock.assert_async().await;
println!("{:#?}", response);
assert_eq!(response.status(), StatusCode::OK);
}
Expand Down

0 comments on commit 7cd72fa

Please sign in to comment.