diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-04 11:32:05 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-04 14:23:54 +0100 |
| commit | 771f944af447c202eba045936a36dee71ab797ac (patch) | |
| tree | e691de4ebc8dde7ac4855e139881ff923bc254ce /src/bin/ngit/sub_commands/login.rs | |
| parent | 949c6459aa7683453a7160423b689ceadb08954b (diff) | |
refactor: fix imports, etc based on restructure
move some functions out of ngit and into lib/mod
and lib/git_events
remove MockConnect from binaries so it is only used in the library.
this was done:
* mainly because automocks were not being imported from
lib into each binary
* but also because the these functions were being
tested with MockConnect
Diffstat (limited to 'src/bin/ngit/sub_commands/login.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/login.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/bin/ngit/sub_commands/login.rs b/src/bin/ngit/sub_commands/login.rs index 8a3788f..df7efa5 100644 --- a/src/bin/ngit/sub_commands/login.rs +++ b/src/bin/ngit/sub_commands/login.rs | |||
| @@ -1,11 +1,12 @@ | |||
| 1 | use anyhow::{Context, Result}; | 1 | use anyhow::{Context, Result}; |
| 2 | use clap; | 2 | use clap; |
| 3 | 3 | ||
| 4 | #[cfg(not(test))] | 4 | use crate::{ |
| 5 | use crate::client::Client; | 5 | cli::Cli, |
| 6 | #[cfg(test)] | 6 | client::{Client, Connect}, |
| 7 | use crate::client::MockConnect; | 7 | git::Repo, |
| 8 | use crate::{cli::Cli, client::Connect, git::Repo, login}; | 8 | login, |
| 9 | }; | ||
| 9 | 10 | ||
| 10 | #[derive(clap::Args)] | 11 | #[derive(clap::Args)] |
| 11 | pub struct SubCommandArgs { | 12 | pub struct SubCommandArgs { |
| @@ -30,10 +31,7 @@ pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { | |||
| 30 | .await?; | 31 | .await?; |
| 31 | Ok(()) | 32 | Ok(()) |
| 32 | } else { | 33 | } else { |
| 33 | #[cfg(not(test))] | ||
| 34 | let client = Client::default(); | 34 | let client = Client::default(); |
| 35 | #[cfg(test)] | ||
| 36 | let client = <MockConnect as std::default::Default>::default(); | ||
| 37 | 35 | ||
| 38 | login::launch( | 36 | login::launch( |
| 39 | &git_repo, | 37 | &git_repo, |