fix auth test in engine (#4354)

* fix auth test in engine

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)

* emoty

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2024-10-29 19:24:24 -07:00
committed by GitHub
parent c161f578fd
commit 9ff51de301
2 changed files with 11 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -1,7 +1,7 @@
//! Types used to send data to the test server. //! Types used to send data to the test server.
use crate::{ use crate::{
executor::{ExecutorContext, ExecutorSettings, IdGenerator}, executor::{new_zoo_client, ExecutorContext, ExecutorSettings, IdGenerator},
settings::types::UnitLength, settings::types::UnitLength,
}; };
@ -43,7 +43,16 @@ async fn do_execute_and_snapshot(ctx: &ExecutorContext, code: &str) -> anyhow::R
} }
async fn new_context(units: UnitLength, with_auth: bool) -> anyhow::Result<ExecutorContext> { async fn new_context(units: UnitLength, with_auth: bool) -> anyhow::Result<ExecutorContext> {
let ctx = ExecutorContext::new_with_client( let mut client = new_zoo_client(if with_auth { None } else { Some("bad_token".to_string()) }, None)?;
if !with_auth {
// Use prod, don't override based on env vars.
// We do this so even in the engine repo, tests that need to run with
// no auth can fail in the same way as they would in prod.
client.set_base_url("https://api.zoo.dev".to_string());
}
let ctx = ExecutorContext::new(
&client,
ExecutorSettings { ExecutorSettings {
units, units,
highlight_edges: true, highlight_edges: true,
@ -51,8 +60,6 @@ async fn new_context(units: UnitLength, with_auth: bool) -> anyhow::Result<Execu
show_grid: false, show_grid: false,
replay: None, replay: None,
}, },
if with_auth { None } else { Some("bad_token".to_string()) },
None,
) )
.await?; .await?;
Ok(ctx) Ok(ctx)