From 636ea8c85e3f05dde83258b45bd6343621727204 Mon Sep 17 00:00:00 2001 From: VC Date: Tue, 15 Nov 2022 19:36:48 +0100 Subject: [PATCH] test: add rate_limit --- tests/config.rs | 8 ++++++++ tests/good_test_rate_limit.toml | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/good_test_rate_limit.toml diff --git a/tests/config.rs b/tests/config.rs index 3919033..bc6c3ad 100644 --- a/tests/config.rs +++ b/tests/config.rs @@ -1,5 +1,12 @@ use scootaloo::parse_toml; +#[test] +fn test_parse_good_toml_rate_limit() { + let parse_good_toml = parse_toml("tests/good_test_rate_limit.toml"); + + assert_eq!(parse_good_toml.scootaloo.rate_limit, Some(69 as usize)); +} + #[test] fn test_parse_good_toml() { let parse_good_toml = parse_toml("tests/good_test.toml"); @@ -9,6 +16,7 @@ fn test_parse_good_toml() { "/var/random/scootaloo.sqlite" ); assert_eq!(parse_good_toml.scootaloo.cache_path, "/tmp/scootaloo"); + assert_eq!(parse_good_toml.scootaloo.rate_limit, None); assert_eq!(parse_good_toml.twitter.consumer_key, "rand consumer key"); assert_eq!(parse_good_toml.twitter.consumer_secret, "secret"); diff --git a/tests/good_test_rate_limit.toml b/tests/good_test_rate_limit.toml new file mode 100644 index 0000000..27b84ea --- /dev/null +++ b/tests/good_test_rate_limit.toml @@ -0,0 +1,20 @@ +[scootaloo] + +db_path="/var/random/scootaloo.sqlite" +cache_path="/tmp/scootaloo" +rate_limit=69 + +[twitter] +consumer_key="rand consumer key" +consumer_secret="secret" +access_key="rand access key" +access_secret="super secret" + +[mastodon] +[mastodon.tamerelol] +twitter_screen_name="tamerelol" +base = "https://m.nintendojo.fr" +client_id = "rand client id" +client_secret = "secret" +redirect = "urn:ietf:wg:oauth:2.0:oob" +token = "super secret"