Skip to content

Commit e7fce99

Browse files
committed
Fix tests and binaries
1 parent b710e8b commit e7fce99

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/bin/project_goals.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use structopt::StructOpt;
2+
use triagebot::zulip::client::ZulipClient;
23
use triagebot::{github::GithubClient, handlers::project_goals};
34

45
/// A basic example
@@ -22,8 +23,10 @@ async fn main() -> anyhow::Result<()> {
2223

2324
let opt = Opt::from_args();
2425
let gh = GithubClient::new_from_env();
26+
let zulip = ZulipClient::new_from_env();
2527
project_goals::ping_project_goals_owners(
2628
&gh,
29+
&zulip,
2730
opt.dry_run,
2831
opt.days_threshold,
2932
&opt.next_meeting_date,

src/tests/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::db::users::record_username;
33
use crate::db::{make_client, ClientPool, PooledClient};
44
use crate::github::GithubClient;
55
use crate::handlers::Context;
6+
use crate::zulip::client::ZulipClient;
67
use octocrab::Octocrab;
78
use std::future::Future;
89
use std::sync::Arc;
@@ -67,8 +68,13 @@ impl TestContext {
6768
"https://api.github.com/graphql".to_string(),
6869
"https://raw.githubusercontent.com".to_string(),
6970
);
71+
let zulip = ZulipClient::new(
72+
"https://rust-fake.zulipchat.com".to_string(),
73+
"[email protected]".to_string(),
74+
);
7075
let ctx = Context {
7176
github,
77+
zulip,
7278
db: pool,
7379
username: "triagebot-test".to_string(),
7480
octocrab,

src/zulip.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ use crate::zulip::api::{MessageApiResponse, Recipient};
1515
use crate::zulip::client::ZulipClient;
1616
use anyhow::{format_err, Context as _};
1717
use rust_team_data::v1::TeamKind;
18-
use std::env;
1918
use std::fmt::Write as _;
2019
use std::str::FromStr;
21-
use std::sync::LazyLock;
2220
use subtle::ConstantTimeEq;
2321
use tracing as log;
2422

src/zulip/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl ZulipClient {
2525
Self::new(instance_url, bot_email)
2626
}
2727

28-
fn new(instance_url: String, bot_email: String) -> Self {
28+
pub fn new(instance_url: String, bot_email: String) -> Self {
2929
let client = Client::new();
3030
Self {
3131
client,

0 commit comments

Comments
 (0)