Skip to content

Commit

Permalink
test: security_opt_serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fabitosh committed Jul 15, 2024
1 parent 123d166 commit 7abc6a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions glrcfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ chrono = { version = "0.4.38", default-features = false, features = [
once_cell = "1.19.0"
regex = { version = "1.10.5", features = ["use_std"] }
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
sqlx = { version = "0.7.4", default-features = false, optional = true }
thiserror = "1.0.61"
toml = "0.8.12"
Expand Down
19 changes: 19 additions & 0 deletions glrcfg/src/runner/executors/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,22 @@ impl Serialize for SecurityOpt {
serializer.serialize_str(&s)
}
}

#[cfg(test)]
mod test {
use serde_json;
use pretty_assertions::assert_eq;

use super::SecurityOpt;

#[test]
fn security_opt_serialization() {
let opt = SecurityOpt {
key: "warbl".to_string(),
value: "garbl".to_string(),
};

let serialized = serde_json::to_string(&opt).unwrap();
assert_eq!(serialized, "\"warbl:garbl\"");
}
}

0 comments on commit 7abc6a1

Please sign in to comment.