Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ mod tests {
.join("testclient.yaml");
assert!(file_path.exists());

let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let client: ClientRepresentation = serde_yaml::from_str(&content).unwrap();

assert_eq!(client.client_id.as_deref(), Some("testclient"));
Expand Down
2 changes: 1 addition & 1 deletion src/cli/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod tests {
.join("my-group.yaml");
assert!(file_path.exists());

let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let group: GroupRepresentation = serde_yaml::from_str(&content).unwrap();
assert_eq!(group.name.as_deref(), Some("my-group"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/idp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod tests {
.join("google.yaml");
assert!(file_path.exists());

let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let idp: IdentityProviderRepresentation = serde_yaml::from_str(&content).unwrap();
assert_eq!(idp.alias.as_deref(), Some("google"));
}
Expand Down
12 changes: 6 additions & 6 deletions src/cli/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub async fn rotate_keys_yaml(workspace_dir: &Path, realm: &str) -> Result<usize
}

let mut rotated_count = 0;
let mut entries = fs::read_dir(&keys_dir)
let mut entries = tokio::fs::read_dir(&keys_dir)
.await
.context("Failed to read components directory")?;

Expand All @@ -64,7 +64,7 @@ pub async fn rotate_keys_yaml(workspace_dir: &Path, realm: &str) -> Result<usize
.extension()
.is_some_and(|ext| ext == "yaml" || ext == "yml")
{
let yaml_content = fs::read_to_string(&path)
let yaml_content = tokio::fs::read_to_string(&path)
.await
.context("Failed to read key YAML file")?;

Expand Down Expand Up @@ -155,14 +155,14 @@ mod tests {
let count = rotate_keys_yaml(workspace_dir, "master").await.unwrap();
assert_eq!(count, 1);

let mut entries = fs::read_dir(&keys_dir).await.unwrap();
let mut entries = tokio::fs::read_dir(&keys_dir).await.unwrap();
let mut found_rotated = false;

while let Some(entry) = entries.next_entry().await.unwrap() {
let name = entry.file_name().to_string_lossy().to_string();
if name.starts_with("rsa-generated-rotated-") {
found_rotated = true;
let content = fs::read_to_string(entry.path()).await.unwrap();
let content = tokio::fs::read_to_string(entry.path()).await.unwrap();
let rotated: ComponentRepresentation = serde_yaml::from_str(&content).unwrap();

let config = rotated.config.unwrap();
Expand Down Expand Up @@ -224,11 +224,11 @@ mod tests {
let count = rotate_keys_yaml(workspace_dir, "master").await.unwrap();
assert_eq!(count, 1); // It still rotates, but priority won't be updated

let mut entries = fs::read_dir(&keys_dir).await.unwrap();
let mut entries = tokio::fs::read_dir(&keys_dir).await.unwrap();
while let Some(entry) = entries.next_entry().await.unwrap() {
let name = entry.file_name().to_string_lossy().to_string();
if name.starts_with("rsa-rotated-") {
let content = fs::read_to_string(entry.path()).await.unwrap();
let content = tokio::fs::read_to_string(entry.path()).await.unwrap();
let rotated: ComponentRepresentation = serde_yaml::from_str(&content).unwrap();
let config = rotated.config.unwrap();
let priority_array = config.get("priority").unwrap().as_array().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/cli/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mod tests {
.join("roles")
.join("admin.yaml");
assert!(realm_role_path.exists());
let content = fs::read_to_string(&realm_role_path).await.unwrap();
let content = tokio::fs::read_to_string(&realm_role_path).await.unwrap();
let role: RoleRepresentation = serde_yaml::from_str(&content).unwrap();
assert_eq!(role.name, "admin");
assert!(!role.client_role);
Expand Down
14 changes: 7 additions & 7 deletions src/cli/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub async fn change_user_password_yaml(
create_user_yaml(workspace_dir, realm, username, None, None, None).await?;
}

let yaml_content = fs::read_to_string(&file_path)
let yaml_content = tokio::fs::read_to_string(&file_path)
.await
.context("Failed to read user YAML file")?;
let mut user: UserRepresentation =
Expand Down Expand Up @@ -218,7 +218,7 @@ mod tests {
.join("testuser.yaml");
assert!(file_path.exists());

let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let user: UserRepresentation = serde_yaml::from_str(&content).unwrap();

assert_eq!(user.username.as_deref(), Some("testuser"));
Expand All @@ -240,7 +240,7 @@ mod tests {
.join("master")
.join("users")
.join("user2.yaml");
let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let user: UserRepresentation = serde_yaml::from_str(&content).unwrap();

assert_eq!(user.username.as_deref(), Some("user2"));
Expand Down Expand Up @@ -272,7 +272,7 @@ mod tests {
.join("master")
.join("users")
.join("testuser.yaml");
let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let user: UserRepresentation = serde_yaml::from_str(&content).unwrap();

let credentials = user.credentials.unwrap();
Expand Down Expand Up @@ -313,7 +313,7 @@ mod tests {
.await
.unwrap();

let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let updated_user: UserRepresentation = serde_yaml::from_str(&content).unwrap();
let credentials = updated_user.credentials.unwrap();
assert_eq!(credentials.len(), 2);
Expand Down Expand Up @@ -344,7 +344,7 @@ mod tests {
.join("master")
.join("users")
.join("testuser.yaml");
let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let user: UserRepresentation = serde_yaml::from_str(&content).unwrap();

let credentials = user.credentials.expect("Credentials should not be None");
Expand All @@ -369,7 +369,7 @@ mod tests {
.join("newuser.yaml");
assert!(file_path.exists());

let content = fs::read_to_string(&file_path).await.unwrap();
let content = tokio::fs::read_to_string(&file_path).await.unwrap();
let user: UserRepresentation = serde_yaml::from_str(&content).unwrap();
let credentials = user.credentials.unwrap();
assert_eq!(credentials[0].value.as_deref(), Some("pass123"));
Expand Down
Loading