diff options
author | 2021-05-14 07:33:45 -0700 | |
---|---|---|
committer | 2021-05-14 07:33:45 -0700 | |
commit | 8a6ee9bca902db076be12745967a69c7c184e044 (patch) | |
tree | 480244bde1110a33bf4bcd7f18b2406ff7bc8571 /src/lib.rs | |
parent | b22ae2cf8a9e2b6af1a54f79ecdb31ad4d2c31c5 (diff) | |
download | notion-8a6ee9bca902db076be12745967a69c7c184e044.tar.gz notion-8a6ee9bca902db076be12745967a69c7c184e044.tar.zst notion-8a6ee9bca902db076be12745967a69c7c184e044.zip |
split models
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,6 +1,5 @@ use crate::models::search::SearchRequest; use crate::models::{Database, ListResponse}; -use std::collections::HashMap; mod models; @@ -54,11 +53,15 @@ mod tests { use crate::NotionApi; const TEST_TOKEN: &'static str = include_str!(".api_token"); + fn test_client() -> NotionApi { + NotionApi { + token: TEST_TOKEN.trim().to_string(), + } + } + #[tokio::test] async fn list_databases() -> Result<(), Box<dyn std::error::Error>> { - let api = NotionApi { - token: TEST_TOKEN.to_string(), - }; + let api = test_client(); dbg!(api.list_databases().await?); @@ -67,9 +70,7 @@ mod tests { #[tokio::test] async fn search() -> Result<(), Box<dyn std::error::Error>> { - let api = NotionApi { - token: TEST_TOKEN.to_string(), - }; + let api = test_client(); dbg!( api.search(NotionSearch::Filter { |