Skip to content

Commit

Permalink
Merge branch 'v5' into geal/third-party-reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Nov 4, 2024
2 parents adfe31d + f099d38 commit e8b84c8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions biscuit-auth/tests/macros.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use biscuit_auth::{builder, KeyPair};
use biscuit_auth::{builder, datalog::RunLimits, KeyPair};
use biscuit_quote::{
authorizer, authorizer_merge, biscuit, biscuit_merge, block, block_merge, check, fact, policy,
rule,
};
use serde_json::json;
use std::{collections::BTreeSet, convert::TryInto};
use std::{collections::BTreeSet, convert::TryInto, time::Duration};

#[test]
fn block_macro() {
Expand Down Expand Up @@ -237,7 +237,7 @@ fn json() {
);
let json_value: biscuit_auth::builder::Term = value.try_into().unwrap();

let authorizer = authorizer!(
let mut authorizer = authorizer!(
r#"
user_roles({json_value});
allow if
Expand All @@ -247,5 +247,14 @@ fn json() {
$value.get("roles").contains("admin");"#
);

assert!(biscuit.authorize(&authorizer).is_ok());
authorizer.add_token(&biscuit).unwrap();
assert_eq!(
authorizer
.authorize_with_limits(RunLimits {
max_time: Duration::from_secs(1),
..Default::default()
})
.unwrap(),
0
);
}

0 comments on commit e8b84c8

Please sign in to comment.