Skip to content

Commit a444e87

Browse files
committed
Login before every test
1 parent 90fe3d0 commit a444e87

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/tests.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ impl AsyncTestContext for MainContext {
3232
if !test_host.is_empty() {
3333
zoo.set_base_url(&test_host);
3434
}
35+
login(test_host.clone(), test_token.clone()).await;
3536

3637
Self {
3738
test_host,
@@ -43,6 +44,28 @@ impl AsyncTestContext for MainContext {
4344
async fn teardown(self) {}
4445
}
4546

47+
async fn login(test_host: String, test_token: String) {
48+
tokio::task::spawn_local(async move {
49+
run_test(TestItem {
50+
name: "login".to_string(),
51+
args: vec![
52+
"zoo".to_string(),
53+
"auth".to_string(),
54+
"login".to_string(),
55+
"--host".to_string(),
56+
test_host.clone(),
57+
"--with-token".to_string(),
58+
],
59+
stdin: Some(test_token),
60+
want_out: "✔ Logged in as ".to_string(),
61+
want_err: "".to_string(),
62+
want_code: 0,
63+
..Default::default()
64+
})
65+
.await;
66+
});
67+
}
68+
4669
#[test_context(MainContext)]
4770
#[tokio::test(flavor = "multi_thread", worker_threads = 3)]
4871
#[serial_test::serial]
@@ -202,29 +225,6 @@ async fn serial_test_version(_ctx: &mut MainContext) {
202225
.await;
203226
}
204227

205-
#[test_context(MainContext)]
206-
#[tokio::test(flavor = "multi_thread", worker_threads = 3)]
207-
#[serial_test::serial]
208-
async fn serial_test_login(ctx: &mut MainContext) {
209-
run_test(TestItem {
210-
name: "login".to_string(),
211-
args: vec![
212-
"zoo".to_string(),
213-
"auth".to_string(),
214-
"login".to_string(),
215-
"--host".to_string(),
216-
ctx.test_host.clone(),
217-
"--with-token".to_string(),
218-
],
219-
stdin: Some(ctx.test_token.clone()),
220-
want_out: "✔ Logged in as ".to_string(),
221-
want_err: "".to_string(),
222-
want_code: 0,
223-
..Default::default()
224-
})
225-
.await;
226-
}
227-
228228
#[test_context(MainContext)]
229229
#[tokio::test(flavor = "multi_thread", worker_threads = 3)]
230230
#[serial_test::serial]

0 commit comments

Comments
 (0)