mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-20 17:11:19 +02:00
44 lines
1.4 KiB
Rust
44 lines
1.4 KiB
Rust
use scootaloo::parse_toml;
|
|
|
|
#[test]
|
|
fn test_parse_good_toml() {
|
|
let parse_good_toml = parse_toml("tests/good_test.toml");
|
|
|
|
assert_eq!(
|
|
parse_good_toml.scootaloo.db_path,
|
|
"/var/random/scootaloo.sqlite"
|
|
);
|
|
assert_eq!(parse_good_toml.scootaloo.cache_path, "/tmp/scootaloo");
|
|
|
|
assert_eq!(parse_good_toml.twitter.username, "tamerelol");
|
|
assert_eq!(parse_good_toml.twitter.consumer_key, "rand consumer key");
|
|
assert_eq!(parse_good_toml.twitter.consumer_secret, "secret");
|
|
assert_eq!(parse_good_toml.twitter.access_key, "rand access key");
|
|
assert_eq!(parse_good_toml.twitter.access_secret, "super secret");
|
|
|
|
assert_eq!(parse_good_toml.mastodon.base, "https://m.nintendojo.fr");
|
|
assert_eq!(parse_good_toml.mastodon.client_id, "rand client id");
|
|
assert_eq!(parse_good_toml.mastodon.client_secret, "secret");
|
|
assert_eq!(
|
|
parse_good_toml.mastodon.redirect,
|
|
"urn:ietf:wg:oauth:2.0:oob"
|
|
);
|
|
assert_eq!(parse_good_toml.mastodon.token, "super secret");
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(
|
|
expected = "Cannot open config file tests/no_file.toml: No such file or directory (os error 2)"
|
|
)]
|
|
fn test_parse_no_toml() {
|
|
let _parse_no_toml = parse_toml("tests/no_file.toml");
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(
|
|
expected = "Cannot parse TOML file tests/bad_test.toml: expected an equals, found a newline at line 1 column 5"
|
|
)]
|
|
fn test_parse_bad_toml() {
|
|
let _parse_bad_toml = parse_toml("tests/bad_test.toml");
|
|
}
|