Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timonv committed Feb 3, 2025
1 parent bf89659 commit faa9942
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/onboarding/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn git_questions(context: &mut tera::Context) -> Result<()> {

println!("\nWith a github token, Kwaak can create pull requests, search github code, and automatically push to the remote. Kwaak will never push to the main branch.");

let github_api_key = prompt_api_key("GitHub token (optional, <esc> to skip)", None)
let github_api_key = prompt_api_key("Github token (optional, <esc> to skip)", None)
.with_placeholder("env:GITHUB_token")
.prompt_skippable()?;

Expand Down
19 changes: 11 additions & 8 deletions tests/cli_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use assert_cmd::{cargo::cargo_bin, prelude::*};
use kwaak::test_utils::temp_env;
use predicates::prelude::*;
use rexpect::{process::wait::WaitStatus, spawn};
use std::process::Command;
use std::{process::Command, time::Duration};
use tempfile::TempDir;

struct Context {
Expand Down Expand Up @@ -106,16 +106,19 @@ async fn test_interactive_default_init() {

let mut p = spawn(&format!("{cmd:?} init --dry-run"), Some(30_000)).unwrap();

let mut num_attempts = 0;
let mut set_github_token = false;
while let Ok(line) = p.read_line() {
// tokio::time::sleep(Duration::from_millis(1)).await;

println!("{line}");
// if line.contains("Dry run, would have written") {
// break;
// }
if line.contains("base url") {
let _ = p.send_line("https://api.bosun.ai");
} else {
let _ = p.send_line("");
if line.contains("Github token (optional") && !set_github_token {
let _ = p.send_line("env:GITHUB_TOKEN");
set_github_token = true;
}
let _ = p.send_line("");

num_attempts += 1;
}

println!("{}", p.exp_eof().unwrap());
Expand Down

0 comments on commit faa9942

Please sign in to comment.