summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2023-11-29 21:18:55 +0100
committerCyborus <cyborus@cyborus.xyz>2023-11-30 01:09:15 +0100
commitcea10e2fcafbbae4d16f081524862240d41cc949 (patch)
tree20503f326b3b58637e69a03c8c946b9be791e5c4 /tests
parentadd ci pipeline (diff)
downloadforgejo-api-cea10e2fcafbbae4d16f081524862240d41cc949.tar.xz
forgejo-api-cea10e2fcafbbae4d16f081524862240d41cc949.zip
add testing boilerplate
Diffstat (limited to 'tests')
-rw-r--r--tests/ci_test.rs31
1 files changed, 26 insertions, 5 deletions
diff --git a/tests/ci_test.rs b/tests/ci_test.rs
index ffa6392..11d7e64 100644
--- a/tests/ci_test.rs
+++ b/tests/ci_test.rs
@@ -1,6 +1,27 @@
-#[test]
-fn ci() {
- let url = url::Url::parse(&std::env::var("FORGEJO_API_CI_INSTANCE_URL").unwrap()).unwrap();
- let token = std::env::var("FORGEJO_API_CI_TOKEN").unwrap();
- let api = forgejo_api::Forgejo::new(&token, url).unwrap();
+use forgejo_api::{Forgejo, ForgejoError};
+
+#[tokio::test]
+async fn ci() -> eyre::Result<()> {
+ let url = url::Url::parse(&std::env::var("FORGEJO_API_CI_INSTANCE_URL")?)?;
+ let token = std::env::var("FORGEJO_API_CI_TOKEN")?;
+ let api = Forgejo::new(&token, url)?;
+
+ let mut results = Vec::new();
+
+ results.push(user(&api).await.map_err(|e| eyre::eyre!("user error: {e}")));
+
+ let mut errors = 0;
+ for res in results.into_iter().filter_map(Result::err) {
+ errors += 1;
+ println!("{res}");
+ }
+ if errors > 0 {
+ eyre::bail!("test failed");
+ }
+
+ Ok(())
+}
+
+async fn user(api: &forgejo_api::Forgejo) -> Result<(), ForgejoError> {
+ Ok(())
}