From bc5b7532a4cf1403ca962256c97e0ced112188e6 Mon Sep 17 00:00:00 2001 From: 23prime <23.prime.37@gmail.com> Date: Sun, 15 Mar 2026 13:29:27 +0900 Subject: [PATCH 1/3] refactor: add default unimplemented!() to BacklogApi trait, remove boilerplate stubs from test MockApis --- src/api/mod.rs | 192 ++++++++---- src/cmd/auth.rs | 235 +------------- src/cmd/issue/attachment/list.rs | 208 +------------ src/cmd/issue/comment/add.rs | 204 +----------- src/cmd/issue/comment/delete.rs | 204 +----------- src/cmd/issue/comment/list.rs | 208 +------------ src/cmd/issue/comment/update.rs | 203 +----------- src/cmd/issue/count.rs | 208 +------------ src/cmd/issue/create.rs | 208 +------------ src/cmd/issue/delete.rs | 208 +------------ src/cmd/issue/list.rs | 208 +------------ src/cmd/issue/show.rs | 208 +------------ src/cmd/issue/update.rs | 208 +------------ src/cmd/notification/count.rs | 154 +-------- src/cmd/notification/list.rs | 299 +----------------- src/cmd/notification/read.rs | 153 --------- src/cmd/notification/reset_unread.rs | 154 +-------- src/cmd/project/activities.rs | 436 -------------------------- src/cmd/project/category.rs | 222 ------------- src/cmd/project/disk_usage.rs | 222 ------------- src/cmd/project/issue_type.rs | 222 ------------- src/cmd/project/list.rs | 225 -------------- src/cmd/project/show.rs | 225 -------------- src/cmd/project/status.rs | 222 ------------- src/cmd/project/user.rs | 222 ------------- src/cmd/project/version.rs | 222 ------------- src/cmd/space/activities.rs | 438 -------------------------- src/cmd/space/disk_usage.rs | 222 ------------- src/cmd/space/licence.rs | 222 ------------- src/cmd/space/notification.rs | 220 ------------- src/cmd/space/show.rs | 222 ------------- src/cmd/space/update_notification.rs | 217 ------------- src/cmd/team/list.rs | 450 --------------------------- src/cmd/team/show.rs | 225 -------------- src/cmd/user/activities.rs | 436 -------------------------- src/cmd/user/list.rs | 225 -------------- src/cmd/user/recently_viewed.rs | 440 +------------------------- src/cmd/user/show.rs | 225 -------------- src/cmd/wiki/attachment/list.rs | 207 +----------- src/cmd/wiki/create.rs | 207 +----------- src/cmd/wiki/delete.rs | 207 +----------- src/cmd/wiki/history.rs | 207 +----------- src/cmd/wiki/list.rs | 207 +----------- src/cmd/wiki/show.rs | 207 +----------- src/cmd/wiki/update.rs | 207 +----------- 45 files changed, 168 insertions(+), 10503 deletions(-) diff --git a/src/api/mod.rs b/src/api/mod.rs index 3f06acb..ef6fae9 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -34,66 +34,154 @@ use user::{RecentlyViewedIssue, User}; use wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; pub trait BacklogApi { - fn get_space(&self) -> Result; - fn get_myself(&self) -> Result; - fn get_users(&self) -> Result>; - fn get_user(&self, user_id: u64) -> Result; - fn get_space_activities(&self, params: &[(String, String)]) -> Result>; - fn get_space_disk_usage(&self) -> Result; - fn get_space_notification(&self) -> Result; - fn get_projects(&self) -> Result>; - fn get_project(&self, key: &str) -> Result; + fn get_space(&self) -> Result { + unimplemented!() + } + fn get_myself(&self) -> Result { + unimplemented!() + } + fn get_users(&self) -> Result> { + unimplemented!() + } + fn get_user(&self, _user_id: u64) -> Result { + unimplemented!() + } + fn get_space_activities(&self, _params: &[(String, String)]) -> Result> { + unimplemented!() + } + fn get_space_disk_usage(&self) -> Result { + unimplemented!() + } + fn get_space_notification(&self) -> Result { + unimplemented!() + } + fn get_projects(&self) -> Result> { + unimplemented!() + } + fn get_project(&self, _key: &str) -> Result { + unimplemented!() + } fn get_project_activities( &self, - key: &str, - params: &[(String, String)], - ) -> Result>; - fn get_project_disk_usage(&self, key: &str) -> Result; - fn get_project_users(&self, key: &str) -> Result>; - fn get_project_statuses(&self, key: &str) -> Result>; - fn get_project_issue_types(&self, key: &str) -> Result>; - fn get_project_categories(&self, key: &str) -> Result>; - fn get_project_versions(&self, key: &str) -> Result>; - fn get_issues(&self, params: &[(String, String)]) -> Result>; - fn count_issues(&self, params: &[(String, String)]) -> Result; - fn get_issue(&self, key: &str) -> Result; - fn create_issue(&self, params: &[(String, String)]) -> Result; - fn update_issue(&self, key: &str, params: &[(String, String)]) -> Result; - fn delete_issue(&self, key: &str) -> Result; - fn get_issue_comments(&self, key: &str) -> Result>; - fn add_issue_comment(&self, key: &str, params: &[(String, String)]) -> Result; + _key: &str, + _params: &[(String, String)], + ) -> Result> { + unimplemented!() + } + fn get_project_disk_usage(&self, _key: &str) -> Result { + unimplemented!() + } + fn get_project_users(&self, _key: &str) -> Result> { + unimplemented!() + } + fn get_project_statuses(&self, _key: &str) -> Result> { + unimplemented!() + } + fn get_project_issue_types(&self, _key: &str) -> Result> { + unimplemented!() + } + fn get_project_categories(&self, _key: &str) -> Result> { + unimplemented!() + } + fn get_project_versions(&self, _key: &str) -> Result> { + unimplemented!() + } + fn get_issues(&self, _params: &[(String, String)]) -> Result> { + unimplemented!() + } + fn count_issues(&self, _params: &[(String, String)]) -> Result { + unimplemented!() + } + fn get_issue(&self, _key: &str) -> Result { + unimplemented!() + } + fn create_issue(&self, _params: &[(String, String)]) -> Result { + unimplemented!() + } + fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> Result { + unimplemented!() + } + fn delete_issue(&self, _key: &str) -> Result { + unimplemented!() + } + fn get_issue_comments(&self, _key: &str) -> Result> { + unimplemented!() + } + fn add_issue_comment(&self, _key: &str, _params: &[(String, String)]) -> Result { + unimplemented!() + } fn update_issue_comment( &self, - key: &str, - comment_id: u64, - params: &[(String, String)], - ) -> Result; - fn delete_issue_comment(&self, key: &str, comment_id: u64) -> Result; - fn get_issue_attachments(&self, key: &str) -> Result>; - fn get_wikis(&self, params: &[(String, String)]) -> Result>; - fn get_wiki(&self, wiki_id: u64) -> Result; - fn create_wiki(&self, params: &[(String, String)]) -> Result; - fn update_wiki(&self, wiki_id: u64, params: &[(String, String)]) -> Result; - fn delete_wiki(&self, wiki_id: u64, params: &[(String, String)]) -> Result; - fn get_wiki_history(&self, wiki_id: u64) -> Result>; - fn get_wiki_attachments(&self, wiki_id: u64) -> Result>; - fn get_teams(&self, params: &[(String, String)]) -> Result>; - fn get_team(&self, team_id: u64) -> Result; + _key: &str, + _comment_id: u64, + _params: &[(String, String)], + ) -> Result { + unimplemented!() + } + fn delete_issue_comment(&self, _key: &str, _comment_id: u64) -> Result { + unimplemented!() + } + fn get_issue_attachments(&self, _key: &str) -> Result> { + unimplemented!() + } + fn get_wikis(&self, _params: &[(String, String)]) -> Result> { + unimplemented!() + } + fn get_wiki(&self, _wiki_id: u64) -> Result { + unimplemented!() + } + fn create_wiki(&self, _params: &[(String, String)]) -> Result { + unimplemented!() + } + fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> Result { + unimplemented!() + } + fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> Result { + unimplemented!() + } + fn get_wiki_history(&self, _wiki_id: u64) -> Result> { + unimplemented!() + } + fn get_wiki_attachments(&self, _wiki_id: u64) -> Result> { + unimplemented!() + } + fn get_teams(&self, _params: &[(String, String)]) -> Result> { + unimplemented!() + } + fn get_team(&self, _team_id: u64) -> Result { + unimplemented!() + } fn get_user_activities( &self, - user_id: u64, - params: &[(String, String)], - ) -> Result>; + _user_id: u64, + _params: &[(String, String)], + ) -> Result> { + unimplemented!() + } fn get_recently_viewed_issues( &self, - params: &[(String, String)], - ) -> Result>; - fn get_notifications(&self, params: &[(String, String)]) -> Result>; - fn count_notifications(&self) -> Result; - fn read_notification(&self, id: u64) -> Result<()>; - fn reset_unread_notifications(&self) -> Result; - fn get_space_licence(&self) -> Result; - fn put_space_notification(&self, content: &str) -> Result; + _params: &[(String, String)], + ) -> Result> { + unimplemented!() + } + fn get_notifications(&self, _params: &[(String, String)]) -> Result> { + unimplemented!() + } + fn count_notifications(&self) -> Result { + unimplemented!() + } + fn read_notification(&self, _id: u64) -> Result<()> { + unimplemented!() + } + fn reset_unread_notifications(&self) -> Result { + unimplemented!() + } + fn get_space_licence(&self) -> Result { + unimplemented!() + } + fn put_space_notification(&self, _content: &str) -> Result { + unimplemented!() + } } impl BacklogApi for BacklogClient { diff --git a/src/cmd/auth.rs b/src/cmd/auth.rs index f4f899e..9ea01e0 100644 --- a/src/cmd/auth.rs +++ b/src/cmd/auth.rs @@ -361,8 +361,8 @@ fn prompt(label: &str) -> Result { #[cfg(test)] mod tests { use super::*; + use crate::api::BacklogApi; use crate::api::user::User; - use crate::api::{BacklogApi, space::Space}; use anyhow::anyhow; struct MockApi { @@ -370,244 +370,11 @@ mod tests { } impl BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { self.user .clone() .ok_or_else(|| anyhow!("invalid credentials")) } - - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_user() -> User { diff --git a/src/cmd/issue/attachment/list.rs b/src/cmd/issue/attachment/list.rs index 953eb39..a9f659e 100644 --- a/src/cmd/issue/attachment/list.rs +++ b/src/cmd/issue/attachment/list.rs @@ -43,7 +43,7 @@ pub fn list_with(args: &IssueAttachmentListArgs, api: &dyn BacklogApi) -> Result #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount, IssueUser}; + use crate::api::issue::{IssueAttachment, IssueUser}; use anyhow::anyhow; use std::collections::BTreeMap; @@ -74,217 +74,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { self.attachments .clone() .ok_or_else(|| anyhow!("no attachments")) } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueAttachmentListArgs { diff --git a/src/cmd/issue/comment/add.rs b/src/cmd/issue/comment/add.rs index 8fd38e0..555ab23 100644 --- a/src/cmd/issue/comment/add.rs +++ b/src/cmd/issue/comment/add.rs @@ -38,7 +38,7 @@ pub fn add_with(args: &IssueCommentAddArgs, api: &dyn BacklogApi) -> Result<()> #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::IssueComment; use crate::cmd::issue::comment::list::sample_comment; use anyhow::anyhow; @@ -47,102 +47,6 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } fn add_issue_comment( &self, _key: &str, @@ -150,112 +54,6 @@ mod tests { ) -> anyhow::Result { self.comment.clone().ok_or_else(|| anyhow!("add failed")) } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueCommentAddArgs { diff --git a/src/cmd/issue/comment/delete.rs b/src/cmd/issue/comment/delete.rs index b0497de..1daba80 100644 --- a/src/cmd/issue/comment/delete.rs +++ b/src/cmd/issue/comment/delete.rs @@ -40,7 +40,7 @@ pub fn delete_with(args: &IssueCommentDeleteArgs, api: &dyn BacklogApi) -> Resul #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::IssueComment; use crate::cmd::issue::comment::list::sample_comment; use anyhow::anyhow; @@ -49,117 +49,6 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } fn delete_issue_comment( &self, _key: &str, @@ -167,97 +56,6 @@ mod tests { ) -> anyhow::Result { self.comment.clone().ok_or_else(|| anyhow!("delete failed")) } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueCommentDeleteArgs { diff --git a/src/cmd/issue/comment/list.rs b/src/cmd/issue/comment/list.rs index 3836a06..f413644 100644 --- a/src/cmd/issue/comment/list.rs +++ b/src/cmd/issue/comment/list.rs @@ -80,7 +80,7 @@ pub(crate) fn sample_comment() -> crate::api::issue::IssueComment { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::IssueComment; use anyhow::anyhow; struct MockApi { @@ -88,215 +88,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { self.comments.clone().ok_or_else(|| anyhow!("no comments")) } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueCommentListArgs { diff --git a/src/cmd/issue/comment/update.rs b/src/cmd/issue/comment/update.rs index 8dc0233..f2948fe 100644 --- a/src/cmd/issue/comment/update.rs +++ b/src/cmd/issue/comment/update.rs @@ -44,7 +44,7 @@ pub fn update_with(args: &IssueCommentUpdateArgs, api: &dyn BacklogApi) -> Resul #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::IssueComment; use crate::cmd::issue::comment::list::sample_comment; use anyhow::anyhow; @@ -53,109 +53,6 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } fn update_issue_comment( &self, _key: &str, @@ -164,104 +61,6 @@ mod tests { ) -> anyhow::Result { self.comment.clone().ok_or_else(|| anyhow!("update failed")) } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueCommentUpdateArgs { diff --git a/src/cmd/issue/count.rs b/src/cmd/issue/count.rs index a8550e5..56fa297 100644 --- a/src/cmd/issue/count.rs +++ b/src/cmd/issue/count.rs @@ -94,7 +94,7 @@ fn build_params(args: &IssueCountArgs) -> Vec<(String, String)> { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::IssueCount; use anyhow::anyhow; struct MockApi { @@ -102,217 +102,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { self.count .map(|c| IssueCount { count: c }) .ok_or_else(|| anyhow!("no count")) } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueCountArgs { diff --git a/src/cmd/issue/create.rs b/src/cmd/issue/create.rs index 1f48d3a..aaa2924 100644 --- a/src/cmd/issue/create.rs +++ b/src/cmd/issue/create.rs @@ -77,7 +77,7 @@ pub fn create_with(args: &IssueCreateArgs, api: &dyn BacklogApi) -> Result<()> { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::Issue; use crate::cmd::issue::list::sample_issue; use anyhow::anyhow; @@ -86,215 +86,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { self.issue.clone().ok_or_else(|| anyhow!("create failed")) } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueCreateArgs { diff --git a/src/cmd/issue/delete.rs b/src/cmd/issue/delete.rs index 004caa7..d7dab0b 100644 --- a/src/cmd/issue/delete.rs +++ b/src/cmd/issue/delete.rs @@ -35,7 +35,7 @@ pub fn delete_with(args: &IssueDeleteArgs, api: &dyn BacklogApi) -> Result<()> { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::Issue; use crate::cmd::issue::list::sample_issue; use anyhow::anyhow; @@ -44,215 +44,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } fn delete_issue(&self, _key: &str) -> anyhow::Result { self.issue.clone().ok_or_else(|| anyhow!("delete failed")) } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueDeleteArgs { diff --git a/src/cmd/issue/list.rs b/src/cmd/issue/list.rs index 0397dd5..b8549b9 100644 --- a/src/cmd/issue/list.rs +++ b/src/cmd/issue/list.rs @@ -186,7 +186,7 @@ pub(crate) fn sample_issue() -> crate::api::issue::Issue { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount, IssueUser}; + use crate::api::issue::{Issue, IssueUser}; use anyhow::anyhow; use std::collections::BTreeMap; @@ -195,215 +195,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { self.issues.clone().ok_or_else(|| anyhow!("no issues")) } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueListArgs { diff --git a/src/cmd/issue/show.rs b/src/cmd/issue/show.rs index 1e6674b..c7daef9 100644 --- a/src/cmd/issue/show.rs +++ b/src/cmd/issue/show.rs @@ -59,7 +59,7 @@ pub fn print_issue(issue: &Issue) { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::Issue; use crate::cmd::issue::list::sample_issue; use anyhow::anyhow; @@ -68,215 +68,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } fn get_issue(&self, _key: &str) -> anyhow::Result { self.issue.clone().ok_or_else(|| anyhow!("no issue")) } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueShowArgs { diff --git a/src/cmd/issue/update.rs b/src/cmd/issue/update.rs index 3443667..e9b2c95 100644 --- a/src/cmd/issue/update.rs +++ b/src/cmd/issue/update.rs @@ -100,7 +100,7 @@ pub fn update_with(args: &IssueUpdateArgs, api: &dyn BacklogApi) -> Result<()> { #[cfg(test)] mod tests { use super::*; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; + use crate::api::issue::Issue; use crate::cmd::issue::list::sample_issue; use anyhow::anyhow; @@ -109,215 +109,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn count_issues(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } fn update_issue(&self, _key: &str, _params: &[(String, String)]) -> anyhow::Result { self.issue.clone().ok_or_else(|| anyhow!("update failed")) } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments(&self, _key: &str) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> IssueUpdateArgs { diff --git a/src/cmd/notification/count.rs b/src/cmd/notification/count.rs index 1d6e0fe..5f91112 100644 --- a/src/cmd/notification/count.rs +++ b/src/cmd/notification/count.rs @@ -34,168 +34,16 @@ pub fn count_with(args: &NotificationCountArgs, api: &dyn BacklogApi) -> Result< mod tests { use super::*; - use crate::api::activity::Activity; - use crate::api::disk_usage::DiskUsage; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; - use crate::api::notification::{Notification, NotificationCount}; - use crate::api::project::{ - Project, ProjectCategory, ProjectDiskUsage, ProjectIssueType, ProjectStatus, ProjectUser, - ProjectVersion, - }; - use crate::api::space::Space; - use crate::api::space_notification::SpaceNotification; - use crate::api::team::Team; - use crate::api::user::{RecentlyViewedIssue, User}; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::notification::NotificationCount; struct MockApi { count: u64, } impl BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> Result> { - unimplemented!() - } - fn get_user(&self, _: u64) -> Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification(&self) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_activities(&self, _: &str, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_project_disk_usage(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_users(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_issue_types(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_categories(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_versions(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_issues(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_issues(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn create_issue(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn get_issue_comments(&self, _: &str) -> Result> { - unimplemented!() - } - fn add_issue_comment(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _: &str, - _: u64, - _: &[(String, String)], - ) -> Result { - unimplemented!() - } - fn delete_issue_comment(&self, _: &str, _: u64) -> Result { - unimplemented!() - } - fn get_issue_attachments(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_wikis(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_wiki(&self, _: u64) -> Result { - unimplemented!() - } - fn create_wiki(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_wiki_history(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_team(&self, _: u64) -> Result { - unimplemented!() - } - fn get_user_activities(&self, _: u64, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_notifications(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } fn count_notifications(&self) -> Result { Ok(NotificationCount { count: self.count }) } - fn read_notification(&self, _: u64) -> Result<()> { - unimplemented!() - } - fn reset_unread_notifications(&self) -> Result { - unimplemented!() - } - fn get_space_licence(&self) -> Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/notification/list.rs b/src/cmd/notification/list.rs index af5a86b..53d3f4e 100644 --- a/src/cmd/notification/list.rs +++ b/src/cmd/notification/list.rs @@ -96,19 +96,12 @@ fn format_notification(n: &Notification) -> String { mod tests { use super::*; - use crate::api::activity::Activity; - use crate::api::disk_usage::DiskUsage; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; - use crate::api::notification::{Notification, NotificationCount}; - use crate::api::project::{ - Project, ProjectCategory, ProjectDiskUsage, ProjectIssueType, ProjectStatus, ProjectUser, - ProjectVersion, - }; - use crate::api::space::Space; - use crate::api::space_notification::SpaceNotification; - use crate::api::team::Team; - use crate::api::user::{RecentlyViewedIssue, User}; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::issue::Issue; + use crate::api::notification::Notification; + use crate::api::project::Project; + + use crate::api::user::User; + use std::collections::BTreeMap; struct MockApi { @@ -116,149 +109,9 @@ mod tests { } impl BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> Result> { - unimplemented!() - } - fn get_user(&self, _: u64) -> Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification(&self) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_activities(&self, _: &str, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_project_disk_usage(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_users(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_issue_types(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_categories(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_versions(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_issues(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_issues(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn create_issue(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn get_issue_comments(&self, _: &str) -> Result> { - unimplemented!() - } - fn add_issue_comment(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _: &str, - _: u64, - _: &[(String, String)], - ) -> Result { - unimplemented!() - } - fn delete_issue_comment(&self, _: &str, _: u64) -> Result { - unimplemented!() - } - fn get_issue_attachments(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_wikis(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_wiki(&self, _: u64) -> Result { - unimplemented!() - } - fn create_wiki(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_wiki_history(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_team(&self, _: u64) -> Result { - unimplemented!() - } - fn get_user_activities(&self, _: u64, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } fn get_notifications(&self, _: &[(String, String)]) -> Result> { Ok(self.notifications.clone()) } - fn count_notifications(&self) -> Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> Result<()> { - unimplemented!() - } - fn reset_unread_notifications(&self) -> Result { - unimplemented!() - } - fn get_space_licence(&self) -> Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> Result { - unimplemented!() - } } fn make_notification(id: u64, already_read: bool, issue_key: Option<&str>) -> Notification { @@ -407,150 +260,10 @@ mod tests { } impl BacklogApi for MockApiCapture { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> Result> { - unimplemented!() - } - fn get_user(&self, _: u64) -> Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification(&self) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_activities(&self, _: &str, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_project_disk_usage(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_users(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_issue_types(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_categories(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_versions(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_issues(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_issues(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn create_issue(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn get_issue_comments(&self, _: &str) -> Result> { - unimplemented!() - } - fn add_issue_comment(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _: &str, - _: u64, - _: &[(String, String)], - ) -> Result { - unimplemented!() - } - fn delete_issue_comment(&self, _: &str, _: u64) -> Result { - unimplemented!() - } - fn get_issue_attachments(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_wikis(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_wiki(&self, _: u64) -> Result { - unimplemented!() - } - fn create_wiki(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_wiki_history(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_team(&self, _: u64) -> Result { - unimplemented!() - } - fn get_user_activities(&self, _: u64, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } fn get_notifications(&self, params: &[(String, String)]) -> Result> { *self.captured.borrow_mut() = params.to_vec(); Ok(vec![]) } - fn count_notifications(&self) -> Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> Result<()> { - unimplemented!() - } - fn reset_unread_notifications(&self) -> Result { - unimplemented!() - } - fn get_space_licence(&self) -> Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/notification/read.rs b/src/cmd/notification/read.rs index dacbbc5..86e3b75 100644 --- a/src/cmd/notification/read.rs +++ b/src/cmd/notification/read.rs @@ -26,19 +26,6 @@ pub fn read_with(args: &NotificationReadArgs, api: &dyn BacklogApi) -> Result<() mod tests { use super::*; - use crate::api::activity::Activity; - use crate::api::disk_usage::DiskUsage; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; - use crate::api::notification::{Notification, NotificationCount}; - use crate::api::project::{ - Project, ProjectCategory, ProjectDiskUsage, ProjectIssueType, ProjectStatus, ProjectUser, - ProjectVersion, - }; - use crate::api::space::Space; - use crate::api::space_notification::SpaceNotification; - use crate::api::team::Team; - use crate::api::user::{RecentlyViewedIssue, User}; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; use std::cell::Cell; struct MockApi { @@ -46,150 +33,10 @@ mod tests { } impl BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> Result> { - unimplemented!() - } - fn get_user(&self, _: u64) -> Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification(&self) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_activities(&self, _: &str, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_project_disk_usage(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_users(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_issue_types(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_categories(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_versions(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_issues(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_issues(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn create_issue(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn get_issue_comments(&self, _: &str) -> Result> { - unimplemented!() - } - fn add_issue_comment(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _: &str, - _: u64, - _: &[(String, String)], - ) -> Result { - unimplemented!() - } - fn delete_issue_comment(&self, _: &str, _: u64) -> Result { - unimplemented!() - } - fn get_issue_attachments(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_wikis(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_wiki(&self, _: u64) -> Result { - unimplemented!() - } - fn create_wiki(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_wiki_history(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_team(&self, _: u64) -> Result { - unimplemented!() - } - fn get_user_activities(&self, _: u64, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_notifications(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_notifications(&self) -> Result { - unimplemented!() - } fn read_notification(&self, id: u64) -> Result<()> { self.called_with.set(Some(id)); Ok(()) } - fn reset_unread_notifications(&self) -> Result { - unimplemented!() - } - fn get_space_licence(&self) -> Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/notification/reset_unread.rs b/src/cmd/notification/reset_unread.rs index ee541c7..b089a35 100644 --- a/src/cmd/notification/reset_unread.rs +++ b/src/cmd/notification/reset_unread.rs @@ -17,166 +17,14 @@ pub fn reset_unread_with(api: &dyn BacklogApi) -> Result<()> { mod tests { use super::*; - use crate::api::activity::Activity; - use crate::api::disk_usage::DiskUsage; - use crate::api::issue::{Issue, IssueAttachment, IssueComment, IssueCount}; - use crate::api::notification::{Notification, NotificationCount}; - use crate::api::project::{ - Project, ProjectCategory, ProjectDiskUsage, ProjectIssueType, ProjectStatus, ProjectUser, - ProjectVersion, - }; - use crate::api::space::Space; - use crate::api::space_notification::SpaceNotification; - use crate::api::team::Team; - use crate::api::user::{RecentlyViewedIssue, User}; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::notification::NotificationCount; struct MockApi; impl BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> Result> { - unimplemented!() - } - fn get_user(&self, _: u64) -> Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification(&self) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_activities(&self, _: &str, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_project_disk_usage(&self, _: &str) -> Result { - unimplemented!() - } - fn get_project_users(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_issue_types(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_categories(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_project_versions(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_issues(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_issues(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn create_issue(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_issue(&self, _: &str) -> Result { - unimplemented!() - } - fn get_issue_comments(&self, _: &str) -> Result> { - unimplemented!() - } - fn add_issue_comment(&self, _: &str, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _: &str, - _: u64, - _: &[(String, String)], - ) -> Result { - unimplemented!() - } - fn delete_issue_comment(&self, _: &str, _: u64) -> Result { - unimplemented!() - } - fn get_issue_attachments(&self, _: &str) -> Result> { - unimplemented!() - } - fn get_wikis(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_wiki(&self, _: u64) -> Result { - unimplemented!() - } - fn create_wiki(&self, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn update_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn delete_wiki(&self, _: u64, _: &[(String, String)]) -> Result { - unimplemented!() - } - fn get_wiki_history(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _: u64) -> Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_team(&self, _: u64) -> Result { - unimplemented!() - } - fn get_user_activities(&self, _: u64, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_notifications(&self, _: &[(String, String)]) -> Result> { - unimplemented!() - } - fn count_notifications(&self) -> Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> Result<()> { - unimplemented!() - } fn reset_unread_notifications(&self) -> Result { Ok(NotificationCount { count: 0 }) } - fn get_space_licence(&self) -> Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/project/activities.rs b/src/cmd/project/activities.rs index 006368c..4fbdce2 100644 --- a/src/cmd/project/activities.rs +++ b/src/cmd/project/activities.rs @@ -100,35 +100,6 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } fn get_project_activities( &self, key: &str, @@ -139,195 +110,6 @@ mod tests { .clone() .ok_or_else(|| anyhow!("no activities")) } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_activity() -> Activity { @@ -468,35 +250,6 @@ mod tests { } impl crate::api::BacklogApi for MockApiCapture { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } fn get_project_activities( &self, _key: &str, @@ -505,195 +258,6 @@ mod tests { *self.captured.borrow_mut() = params.to_vec(); Ok(vec![]) } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/project/category.rs b/src/cmd/project/category.rs index 751cd49..89731f1 100644 --- a/src/cmd/project/category.rs +++ b/src/cmd/project/category.rs @@ -48,233 +48,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } fn get_project_categories(&self, _key: &str) -> anyhow::Result> { self.categories .clone() .ok_or_else(|| anyhow!("no categories")) } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_category() -> ProjectCategory { diff --git a/src/cmd/project/disk_usage.rs b/src/cmd/project/disk_usage.rs index 37509da..7bcd986 100644 --- a/src/cmd/project/disk_usage.rs +++ b/src/cmd/project/disk_usage.rs @@ -55,233 +55,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } fn get_project_disk_usage(&self, _key: &str) -> anyhow::Result { self.disk_usage .clone() .ok_or_else(|| anyhow!("no disk usage")) } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_disk_usage() -> ProjectDiskUsage { diff --git a/src/cmd/project/issue_type.rs b/src/cmd/project/issue_type.rs index 15eb95f..3ebfb64 100644 --- a/src/cmd/project/issue_type.rs +++ b/src/cmd/project/issue_type.rs @@ -48,233 +48,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } fn get_project_issue_types(&self, _key: &str) -> anyhow::Result> { self.issue_types .clone() .ok_or_else(|| anyhow!("no issue types")) } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_issue_type() -> ProjectIssueType { diff --git a/src/cmd/project/list.rs b/src/cmd/project/list.rs index 12db45b..7d26d6e 100644 --- a/src/cmd/project/list.rs +++ b/src/cmd/project/list.rs @@ -56,234 +56,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } fn get_projects(&self) -> anyhow::Result> { self.projects.clone().ok_or_else(|| anyhow!("no projects")) } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_project() -> Project { diff --git a/src/cmd/project/show.rs b/src/cmd/project/show.rs index ab6d679..bd98815 100644 --- a/src/cmd/project/show.rs +++ b/src/cmd/project/show.rs @@ -50,234 +50,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } fn get_project(&self, _key: &str) -> anyhow::Result { self.project.clone().ok_or_else(|| anyhow!("no project")) } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_project() -> Project { diff --git a/src/cmd/project/status.rs b/src/cmd/project/status.rs index 30f9c34..a47a099 100644 --- a/src/cmd/project/status.rs +++ b/src/cmd/project/status.rs @@ -48,231 +48,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } fn get_project_statuses(&self, _key: &str) -> anyhow::Result> { self.statuses.clone().ok_or_else(|| anyhow!("no statuses")) } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_status() -> ProjectStatus { diff --git a/src/cmd/project/user.rs b/src/cmd/project/user.rs index 7d7e0b1..2b35888 100644 --- a/src/cmd/project/user.rs +++ b/src/cmd/project/user.rs @@ -52,231 +52,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } fn get_project_users(&self, _key: &str) -> anyhow::Result> { self.users.clone().ok_or_else(|| anyhow!("no users")) } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_user() -> ProjectUser { diff --git a/src/cmd/project/version.rs b/src/cmd/project/version.rs index 9a04531..b97b6d2 100644 --- a/src/cmd/project/version.rs +++ b/src/cmd/project/version.rs @@ -55,231 +55,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } fn get_project_versions(&self, _key: &str) -> anyhow::Result> { self.versions.clone().ok_or_else(|| anyhow!("no versions")) } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_version() -> ProjectVersion { diff --git a/src/cmd/space/activities.rs b/src/cmd/space/activities.rs index e40aa20..6ba8246 100644 --- a/src/cmd/space/activities.rs +++ b/src/cmd/space/activities.rs @@ -97,230 +97,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } fn get_space_activities(&self, _: &[(String, String)]) -> Result> { self.activities .clone() .ok_or_else(|| anyhow!("no activities")) } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_activity() -> Activity { @@ -409,229 +190,10 @@ mod tests { } impl crate::api::BacklogApi for MockApiCapture { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } fn get_space_activities(&self, params: &[(String, String)]) -> Result> { *self.captured.borrow_mut() = params.to_vec(); Ok(vec![]) } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/space/disk_usage.rs b/src/cmd/space/disk_usage.rs index d7f6ae5..f2caa0f 100644 --- a/src/cmd/space/disk_usage.rs +++ b/src/cmd/space/disk_usage.rs @@ -55,233 +55,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } fn get_space_disk_usage(&self) -> Result { self.disk_usage .clone() .ok_or_else(|| anyhow!("no disk usage")) } - fn get_space_notification( - &self, - ) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_disk_usage() -> DiskUsage { diff --git a/src/cmd/space/licence.rs b/src/cmd/space/licence.rs index 72fc884..c0263e7 100644 --- a/src/cmd/space/licence.rs +++ b/src/cmd/space/licence.rs @@ -52,231 +52,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } fn get_space_licence(&self) -> Result { self.licence.clone().ok_or_else(|| anyhow!("no licence")) } - fn put_space_notification( - &self, - _content: &str, - ) -> Result { - unimplemented!() - } } fn sample_licence() -> Licence { diff --git a/src/cmd/space/notification.rs b/src/cmd/space/notification.rs index 85d4b30..c23a12f 100644 --- a/src/cmd/space/notification.rs +++ b/src/cmd/space/notification.rs @@ -51,231 +51,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } fn get_space_notification(&self) -> Result { self.notification .clone() .ok_or_else(|| anyhow!("no notification")) } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_notification() -> SpaceNotification { diff --git a/src/cmd/space/show.rs b/src/cmd/space/show.rs index 068e1ad..a0294b6 100644 --- a/src/cmd/space/show.rs +++ b/src/cmd/space/show.rs @@ -57,228 +57,6 @@ mod tests { fn get_space(&self) -> Result { self.space.clone().ok_or_else(|| anyhow!("no space")) } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_space() -> Space { diff --git a/src/cmd/space/update_notification.rs b/src/cmd/space/update_notification.rs index 317f5d4..3f9c317 100644 --- a/src/cmd/space/update_notification.rs +++ b/src/cmd/space/update_notification.rs @@ -67,223 +67,6 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> Result { - unimplemented!() - } - fn get_myself(&self) -> Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> Result { - unimplemented!() - } - fn get_space_notification(&self) -> Result { - unimplemented!() - } - fn get_projects(&self) -> Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> Result { - unimplemented!() - } - fn get_project_users(&self, _key: &str) -> Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> Result { - unimplemented!() - } fn put_space_notification(&self, content: &str) -> Result { *self.captured_content.borrow_mut() = Some(content.to_string()); self.result diff --git a/src/cmd/team/list.rs b/src/cmd/team/list.rs index 2c35f40..2d9d878 100644 --- a/src/cmd/team/list.rs +++ b/src/cmd/team/list.rs @@ -73,234 +73,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { self.teams.clone().ok_or_else(|| anyhow!("no teams")) } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_member() -> TeamMember { @@ -374,235 +149,10 @@ mod tests { } impl crate::api::BacklogApi for MockApiCapture { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } fn get_teams(&self, params: &[(String, String)]) -> anyhow::Result> { *self.captured.borrow_mut() = params.to_vec(); Ok(vec![]) } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/team/show.rs b/src/cmd/team/show.rs index 57d3009..81d09b3 100644 --- a/src/cmd/team/show.rs +++ b/src/cmd/team/show.rs @@ -68,234 +68,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } fn get_team(&self, _team_id: u64) -> anyhow::Result { self.team.clone().ok_or_else(|| anyhow!("no team")) } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_member() -> TeamMember { diff --git a/src/cmd/user/activities.rs b/src/cmd/user/activities.rs index abf8850..71d9724 100644 --- a/src/cmd/user/activities.rs +++ b/src/cmd/user/activities.rs @@ -100,190 +100,6 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } fn get_user_activities( &self, _user_id: u64, @@ -293,40 +109,6 @@ mod tests { .clone() .ok_or_else(|| anyhow!("no activities")) } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_activity() -> Activity { @@ -417,190 +199,6 @@ mod tests { } impl crate::api::BacklogApi for MockApiCapture { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } fn get_user_activities( &self, _user_id: u64, @@ -609,40 +207,6 @@ mod tests { *self.captured.borrow_mut() = params.to_vec(); Ok(vec![]) } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/user/list.rs b/src/cmd/user/list.rs index af60249..6250025 100644 --- a/src/cmd/user/list.rs +++ b/src/cmd/user/list.rs @@ -51,234 +51,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } fn get_users(&self) -> anyhow::Result> { self.users.clone().ok_or_else(|| anyhow!("no users")) } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_user() -> User { diff --git a/src/cmd/user/recently_viewed.rs b/src/cmd/user/recently_viewed.rs index 19294e3..2043c53 100644 --- a/src/cmd/user/recently_viewed.rs +++ b/src/cmd/user/recently_viewed.rs @@ -72,7 +72,7 @@ fn format_row(item: &RecentlyViewedIssue) -> String { #[cfg(test)] mod tests { use super::*; - use crate::api::activity::Activity; + use crate::api::issue::{Issue, IssuePriority, IssueStatus, IssueType, IssueUser}; use anyhow::anyhow; use std::collections::BTreeMap; @@ -82,231 +82,12 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } fn get_recently_viewed_issues( &self, _: &[(String, String)], ) -> anyhow::Result> { self.items.clone().ok_or_else(|| anyhow!("no items")) } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_issue_user() -> IssueUser { @@ -432,197 +213,6 @@ mod tests { } impl crate::api::BacklogApi for MockApiCapture { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } fn get_recently_viewed_issues( &self, params: &[(String, String)], @@ -630,34 +220,6 @@ mod tests { *self.captured.borrow_mut() = params.to_vec(); Ok(vec![]) } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } #[test] diff --git a/src/cmd/user/show.rs b/src/cmd/user/show.rs index b6a1347..8f9b04c 100644 --- a/src/cmd/user/show.rs +++ b/src/cmd/user/show.rs @@ -61,234 +61,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } fn get_user(&self, _user_id: u64) -> anyhow::Result { self.user.clone().ok_or_else(|| anyhow!("no user")) } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki( - &self, - _wiki_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments( - &self, - _wiki_id: u64, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_user() -> User { diff --git a/src/cmd/wiki/attachment/list.rs b/src/cmd/wiki/attachment/list.rs index 10d67e3..9720e3b 100644 --- a/src/cmd/wiki/attachment/list.rs +++ b/src/cmd/wiki/attachment/list.rs @@ -47,7 +47,7 @@ pub fn format_attachment_row(a: &WikiAttachment) -> String { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::wiki::WikiAttachment; use crate::cmd::wiki::list::tests_helper::sample_wiki_user; use anyhow::anyhow; @@ -56,216 +56,11 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { self.attachments .clone() .ok_or_else(|| anyhow!("no attachments")) } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_attachment() -> WikiAttachment { diff --git a/src/cmd/wiki/create.rs b/src/cmd/wiki/create.rs index 73466e0..b4a22ce 100644 --- a/src/cmd/wiki/create.rs +++ b/src/cmd/wiki/create.rs @@ -59,7 +59,7 @@ pub fn create_with(args: &WikiCreateArgs, api: &dyn BacklogApi) -> Result<()> { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::wiki::Wiki; use crate::cmd::wiki::list::tests_helper::sample_wiki_user; use anyhow::anyhow; use std::collections::BTreeMap; @@ -69,214 +69,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { self.wiki.clone().ok_or_else(|| anyhow!("create failed")) } - fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_wiki() -> Wiki { diff --git a/src/cmd/wiki/delete.rs b/src/cmd/wiki/delete.rs index 5b7e288..23fabb7 100644 --- a/src/cmd/wiki/delete.rs +++ b/src/cmd/wiki/delete.rs @@ -45,7 +45,7 @@ pub fn delete_with(args: &WikiDeleteArgs, api: &dyn BacklogApi) -> Result<()> { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::wiki::Wiki; use crate::cmd::wiki::list::tests_helper::sample_wiki_user; use anyhow::anyhow; use std::collections::BTreeMap; @@ -55,214 +55,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { self.wiki.clone().ok_or_else(|| anyhow!("delete failed")) } - fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_wiki() -> Wiki { diff --git a/src/cmd/wiki/history.rs b/src/cmd/wiki/history.rs index c0808f5..3269edf 100644 --- a/src/cmd/wiki/history.rs +++ b/src/cmd/wiki/history.rs @@ -47,7 +47,7 @@ pub fn format_history_row(entry: &WikiHistory) -> String { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem, WikiUser}; + use crate::api::wiki::{WikiHistory, WikiUser}; use crate::cmd::wiki::list::tests_helper::sample_wiki_user; use anyhow::anyhow; @@ -56,214 +56,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { self.history.clone().ok_or_else(|| anyhow!("no history")) } - fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_history(user: WikiUser) -> WikiHistory { diff --git a/src/cmd/wiki/list.rs b/src/cmd/wiki/list.rs index b8558cc..366384d 100644 --- a/src/cmd/wiki/list.rs +++ b/src/cmd/wiki/list.rs @@ -100,7 +100,7 @@ pub(crate) mod tests_helper { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::wiki::WikiListItem; use anyhow::anyhow; use tests_helper::{sample_wiki_list_item, sample_wiki_user}; @@ -109,214 +109,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { self.wikis.clone().ok_or_else(|| anyhow!("no wikis")) } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn args(json: bool) -> WikiListArgs { diff --git a/src/cmd/wiki/show.rs b/src/cmd/wiki/show.rs index 8e71205..1f208a6 100644 --- a/src/cmd/wiki/show.rs +++ b/src/cmd/wiki/show.rs @@ -49,7 +49,7 @@ pub fn print_wiki(wiki: &Wiki) { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem, WikiTag}; + use crate::api::wiki::{Wiki, WikiTag}; use crate::cmd::wiki::list::tests_helper::sample_wiki_user; use anyhow::anyhow; use std::collections::BTreeMap; @@ -59,214 +59,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { self.wiki.clone().ok_or_else(|| anyhow!("no wiki")) } - fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_wiki() -> Wiki { diff --git a/src/cmd/wiki/update.rs b/src/cmd/wiki/update.rs index 245005d..15228f2 100644 --- a/src/cmd/wiki/update.rs +++ b/src/cmd/wiki/update.rs @@ -67,7 +67,7 @@ pub fn update_with(args: &WikiUpdateArgs, api: &dyn BacklogApi) -> Result<()> { #[cfg(test)] mod tests { use super::*; - use crate::api::wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; + use crate::api::wiki::Wiki; use crate::cmd::wiki::list::tests_helper::sample_wiki_user; use anyhow::anyhow; use std::collections::BTreeMap; @@ -77,214 +77,9 @@ mod tests { } impl crate::api::BacklogApi for MockApi { - fn get_space(&self) -> anyhow::Result { - unimplemented!() - } - fn get_myself(&self) -> anyhow::Result { - unimplemented!() - } - fn get_users(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_user(&self, _user_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_space_activities( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_space_disk_usage(&self) -> anyhow::Result { - unimplemented!() - } - fn get_space_notification( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_projects(&self) -> anyhow::Result> { - unimplemented!() - } - fn get_project(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_project_activities( - &self, - _key: &str, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_disk_usage( - &self, - _key: &str, - ) -> anyhow::Result { - unimplemented!() - } - fn get_project_users( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_statuses( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_issue_types( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_categories( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_project_versions( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_issues( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn create_issue( - &self, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue(&self, _key: &str) -> anyhow::Result { - unimplemented!() - } - fn get_issue_comments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn add_issue_comment( - &self, - _key: &str, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn update_issue_comment( - &self, - _key: &str, - _comment_id: u64, - _params: &[(String, String)], - ) -> anyhow::Result { - unimplemented!() - } - fn delete_issue_comment( - &self, - _key: &str, - _comment_id: u64, - ) -> anyhow::Result { - unimplemented!() - } - fn get_issue_attachments( - &self, - _key: &str, - ) -> anyhow::Result> { - unimplemented!() - } - fn get_wikis(&self, _params: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki(&self, _wiki_id: u64) -> anyhow::Result { - unimplemented!() - } - fn create_wiki(&self, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } fn update_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { self.wiki.clone().ok_or_else(|| anyhow!("update failed")) } - fn delete_wiki(&self, _wiki_id: u64, _params: &[(String, String)]) -> anyhow::Result { - unimplemented!() - } - fn get_wiki_history(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_wiki_attachments(&self, _wiki_id: u64) -> anyhow::Result> { - unimplemented!() - } - fn get_teams(&self, _: &[(String, String)]) -> anyhow::Result> { - unimplemented!() - } - fn get_team(&self, _team_id: u64) -> anyhow::Result { - unimplemented!() - } - fn get_user_activities( - &self, - _user_id: u64, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_recently_viewed_issues( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn get_notifications( - &self, - _: &[(String, String)], - ) -> anyhow::Result> { - unimplemented!() - } - fn count_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn read_notification(&self, _: u64) -> anyhow::Result<()> { - unimplemented!() - } - fn reset_unread_notifications( - &self, - ) -> anyhow::Result { - unimplemented!() - } - fn get_space_licence(&self) -> anyhow::Result { - unimplemented!() - } - fn put_space_notification( - &self, - _content: &str, - ) -> anyhow::Result { - unimplemented!() - } } fn sample_wiki() -> Wiki { From 25fc7e24545dabc7c1a0d5bb80c7d158853fffb0 Mon Sep 17 00:00:00 2001 From: 23prime <23.prime.37@gmail.com> Date: Sun, 15 Mar 2026 13:34:23 +0900 Subject: [PATCH 2/3] docs: add usage comment to BacklogApi trait and update patterns.md MockApi section --- .../skills/developing/references/patterns.md | 22 ++++++++++--------- src/api/mod.rs | 15 +++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.claude/skills/developing/references/patterns.md b/.claude/skills/developing/references/patterns.md index a2460ca..0808b35 100644 --- a/.claude/skills/developing/references/patterns.md +++ b/.claude/skills/developing/references/patterns.md @@ -42,12 +42,13 @@ pub mod my_resource; // 1. module declaration use my_resource::MyResource; // 2. import pub trait BacklogApi { - fn get_my_resource(&self) -> Result; // 3a. trait method + // 3a. trait method — default body suppresses compile errors in MockApis + fn get_my_resource(&self, _params: &[(String, String)]) -> Result { unimplemented!() } } impl BacklogApi for BacklogClient { - fn get_my_resource(&self) -> Result { // 3b. impl - self.get_my_resource() + fn get_my_resource(&self, params: &[(String, String)]) -> Result { // 3b. impl + self.get_my_resource(params) } } ``` @@ -89,23 +90,24 @@ Rename inner binding to avoid shadowing: `json: sub_json`. ## Test MockApi pattern -Every test module that implements `BacklogApi` on a `MockApi` **must include ALL trait methods**. -Use `unimplemented!()` for methods not under test: +`BacklogApi` has default `unimplemented!()` bodies for all methods, so a +`MockApi` only needs to override the methods actually exercised by the test. +Do **not** add `unimplemented!()` stubs for unused methods — the default fires +automatically. ```rust struct MockApi { data: Option } impl BacklogApi for MockApi { - fn get_space(&self) -> Result { unimplemented!() } - fn get_myself(&self) -> Result { unimplemented!() } - fn get_space_activities(&self) -> Result> { unimplemented!() } - fn get_my_resource(&self) -> Result { + fn get_my_resource(&self, _params: &[(String, String)]) -> Result { self.data.clone().ok_or_else(|| anyhow!("no data")) } } ``` -Forgetting a method causes a compile error. +When a test calls a method that isn't overridden, it will panic with +`not implemented` — which is the desired behavior (it means the test is +exercising an unexpected code path). ## Known Backlog API gotchas diff --git a/src/api/mod.rs b/src/api/mod.rs index ef6fae9..0be2731 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -33,6 +33,21 @@ use team::Team; use user::{RecentlyViewedIssue, User}; use wiki::{Wiki, WikiAttachment, WikiHistory, WikiListItem}; +/// Abstraction over the Backlog HTTP API. +/// +/// All methods have a default body of `unimplemented!()` so that test +/// `MockApi` structs only need to override the methods actually exercised +/// by the test. `impl BacklogApi for BacklogClient` overrides every method +/// with a real HTTP call. +/// +/// # Adding a new method +/// +/// 1. Add the method signature with a default `{ unimplemented!() }` body +/// here (using `_`-prefixed parameter names to suppress unused-variable +/// warnings in the default). +/// 2. Override it in `impl BacklogApi for BacklogClient` below. +/// 3. Test `MockApi` structs **do not** need to be updated — the default +/// `unimplemented!()` fires automatically if an untested method is called. pub trait BacklogApi { fn get_space(&self) -> Result { unimplemented!() From fbb636638e2c74b95b2b50fd3df6e5fb6f16bace Mon Sep 17 00:00:00 2001 From: 23prime <23.prime.37@gmail.com> Date: Sun, 15 Mar 2026 14:50:22 +0900 Subject: [PATCH 3/3] docs: fix patterns.md cmd example to pass params to get_my_resource --- .claude/skills/developing/references/patterns.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.claude/skills/developing/references/patterns.md b/.claude/skills/developing/references/patterns.md index 0808b35..cbf75df 100644 --- a/.claude/skills/developing/references/patterns.md +++ b/.claude/skills/developing/references/patterns.md @@ -18,8 +18,8 @@ pub struct MyResource { } impl BacklogClient { - pub fn get_my_resource(&self) -> Result { - let value = self.get("/my-resource")?; + pub fn get_my_resource(&self, params: &[(String, String)]) -> Result { + let value = self.get_with_query("/my-resource", params)?; serde_json::from_value(value.clone()).map_err(|e| { anyhow::anyhow!( "Failed to deserialize response: {}\nRaw JSON:\n{}", @@ -62,7 +62,8 @@ pub fn show(json: bool) -> Result<()> { } pub fn show_with(json: bool, api: &dyn BacklogApi) -> Result<()> { - let data = api.get_my_resource()?; + let params: Vec<(String, String)> = vec![]; + let data = api.get_my_resource(¶ms)?; if json { println!("{}", serde_json::to_string_pretty(&data).context("Failed to serialize JSON")?); } else {