Skip to content

Commit 8436997

Browse files
committed
fix: Fix the test by the new improvements
1 parent a1688d8 commit 8436997

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

  • tests/integration/src/assignment/grant

tests/integration/src/assignment/grant/revoke.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ async fn test_revoke_user_project_grant_auth_impact() -> Result<()> {
152152
name: Uuid::new_v4().to_string(),
153153
project_id: "project_a".into(),
154154
roles: vec![
155-
Role {
155+
RoleRef {
156156
id: "role_revoke_auth".into(),
157-
name: "role_revoke_auth".into(),
158-
..Default::default()
157+
domain_id: None,
158+
name: Some("role_exist_auth".into()),
159159
},
160-
Role {
160+
RoleRef {
161161
id: "role_exist_auth".into(),
162-
name: "role_exist_auth".into(),
163-
..Default::default()
162+
name: Some("role_exist_auth".into()),
163+
domain_id: None,
164164
},
165165
],
166166
user_id: user.id.clone(),
@@ -203,6 +203,7 @@ async fn test_revoke_user_project_grant_auth_impact() -> Result<()> {
203203
.is_ok(),
204204
"Token should be valid before revocation"
205205
);
206+
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
206207

207208
// --- Revoke the grant ---
208209
state
@@ -216,6 +217,7 @@ async fn test_revoke_user_project_grant_auth_impact() -> Result<()> {
216217
!grant_exists(&state, &user.id, "project_a", "role_revoke_auth", true).await?,
217218
"Grant should not exist after revocation"
218219
);
220+
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
219221

220222
// CHECK 2: new auth does not obtain the role
221223
let post_revoke_token = state.provider.get_token_provider().issue_token(
@@ -239,7 +241,9 @@ async fn test_revoke_user_project_grant_auth_impact() -> Result<()> {
239241
.validate_token(&state, &post_revoke_encoded, None, None)
240242
.await?;
241243

242-
let roles = validated.roles().expect("Token should have roles");
244+
let roles = validated
245+
.effective_roles()
246+
.expect("Token should have effective roles");
243247

244248
assert!(roles.iter().any(|r| r.id == "role_exist_auth"));
245249
assert!(!roles.iter().any(|r| r.id == "role_revoke_auth"));

0 commit comments

Comments
 (0)