summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-04-20 22:20:30 +0200
committerCyborus <cyborus@cyborus.xyz>2024-04-20 22:20:30 +0200
commita694ab48ff464e6b48d3e0d43dcf7d598b2af850 (patch)
tree9f7a1b28b6695265e497b8b39575b2645af14bca
parentadd derives for query structs (diff)
downloadforgejo-api-a694ab48ff464e6b48d3e0d43dcf7d598b2af850.tar.xz
forgejo-api-a694ab48ff464e6b48d3e0d43dcf7d598b2af850.zip
update tests to use `Default::default` impls for query types
-rw-r--r--tests/ci_test.rs47
1 files changed, 8 insertions, 39 deletions
diff --git a/tests/ci_test.rs b/tests/ci_test.rs
index c4d8a5d..925dc2e 100644
--- a/tests/ci_test.rs
+++ b/tests/ci_test.rs
@@ -24,20 +24,14 @@ async fn user() {
"result of `myself` does not match result of `get_user`"
);
- let query = UserListFollowingQuery {
- page: None,
- limit: None,
- };
+ let query = UserListFollowingQuery::default();
let following = api
.user_list_following("TestingAdmin", query)
.await
.unwrap();
assert_eq!(following, Vec::new(), "following list not empty");
- let query = UserListFollowersQuery {
- page: None,
- limit: None,
- };
+ let query = UserListFollowersQuery::default();
let followers = api
.user_list_followers("TestingAdmin", query)
.await
@@ -168,12 +162,7 @@ async fn repo() {
.await
.is_ok();
assert!(!is_merged, "pr should not yet be merged");
- let pr_files_query = RepoGetPullRequestFilesQuery {
- skip_to: None,
- whitespace: None,
- page: None,
- limit: None,
- };
+ let pr_files_query = RepoGetPullRequestFilesQuery::default();
let (_, _) = api
.repo_get_pull_request_files("TestingAdmin", "test", pr.number.unwrap(), pr_files_query)
.await
@@ -199,13 +188,7 @@ async fn repo() {
let _ = git().args(["fetch"]).status().unwrap();
let _ = git().args(["pull"]).status().unwrap();
- let query = RepoListReleasesQuery {
- draft: None,
- pre_release: None,
- per_page: None,
- page: None,
- limit: None,
- };
+ let query = RepoListReleasesQuery::default();
assert!(
api.repo_list_releases("TestingAdmin", "test", query)
.await
@@ -332,12 +315,7 @@ async fn admin() {
.await
.expect("failed to create user");
- let query = AdminSearchUsersQuery {
- source_id: None,
- login_name: None,
- page: None,
- limit: None,
- };
+ let query = AdminSearchUsersQuery::default();
let users = api
.admin_search_users(query)
.await
@@ -349,10 +327,7 @@ async fn admin() {
.is_some(),
"could not find new user"
);
- let query = AdminGetAllEmailsQuery {
- page: None,
- limit: None,
- };
+ let query = AdminGetAllEmailsQuery::default();
let users = api
.admin_get_all_emails(query)
.await
@@ -379,10 +354,7 @@ async fn admin() {
.admin_create_org("Pipis", org_opt)
.await
.expect("failed to create org");
- let query = AdminGetAllOrgsQuery {
- page: None,
- limit: None,
- };
+ let query = AdminGetAllOrgsQuery::default();
assert!(
!api.admin_get_all_orgs(query).await.unwrap().is_empty(),
"org list empty"
@@ -417,10 +389,7 @@ async fn admin() {
"deleting fake user should fail"
);
- let query = AdminCronListQuery {
- page: None,
- limit: None,
- };
+ let query = AdminCronListQuery::default();
let crons = api
.admin_cron_list(query)
.await