diff options
author | 2021-05-15 21:22:29 -0700 | |
---|---|---|
committer | 2021-05-15 21:22:29 -0700 | |
commit | 016efe592323fcc79848f520dd95589269b0ad2c (patch) | |
tree | 54986e760e43e2c76cc4a9fb208ef2e1ad3e4d2e | |
parent | c3a8b68989f6df0c3a4ebe56aeb7f160e8c7b580 (diff) | |
download | notion-016efe592323fcc79848f520dd95589269b0ad2c.tar.gz notion-016efe592323fcc79848f520dd95589269b0ad2c.tar.zst notion-016efe592323fcc79848f520dd95589269b0ad2c.zip |
feat: adding support for running API tests in CI (using my API token...) (#2)
-rw-r--r-- | src/lib.rs | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -110,10 +110,19 @@ mod tests { }; use crate::{Identifiable, NotionApi}; - const TEST_TOKEN: &'static str = include_str!(".api_token"); + fn test_token() -> String { + let token = { + if let Some(token) = std::env::var("NOTION_API_TOKEN").ok() { + token + } else { + include_str!(".api_token").to_string() + } + }; + token.trim().to_string() + } fn test_client() -> NotionApi { - NotionApi::new(TEST_TOKEN.trim().to_string()).unwrap() + NotionApi::new(test_token()).unwrap() } #[tokio::test] |