about summary refs log tree commit diff stats
path: root/crates/rocie-server/tests/_testenv/init.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-09 13:07:14 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-09 13:07:14 +0100
commitc91dce4f77ae12453203f0a28b91efb6533cc095 (patch)
tree4f50e755dff7f717d45309b08f9fe2c8c87f88bd /crates/rocie-server/tests/_testenv/init.rs
parentchore(rocie-client): Regenerate (diff)
downloadserver-c91dce4f77ae12453203f0a28b91efb6533cc095.zip
feat(rocie-server): Implement basic user handling and authentication
Diffstat (limited to 'crates/rocie-server/tests/_testenv/init.rs')
-rw-r--r--crates/rocie-server/tests/_testenv/init.rs27
1 files changed, 24 insertions, 3 deletions
diff --git a/crates/rocie-server/tests/_testenv/init.rs b/crates/rocie-server/tests/_testenv/init.rs
index 9cb0b91..5318238 100644
--- a/crates/rocie-server/tests/_testenv/init.rs
+++ b/crates/rocie-server/tests/_testenv/init.rs
@@ -19,9 +19,15 @@ use std::{
     process::{self, Stdio},
 };
 
-use rocie_client::apis::configuration::Configuration;
+use rocie_client::{
+    apis::{api_set_no_auth_user_api::provision, configuration::Configuration},
+    models::{LoginInfo, UserStub},
+};
 
-use crate::{_testenv::Paths, testenv::TestEnv};
+use crate::{
+    _testenv::{Paths, log::request},
+    testenv::TestEnv,
+};
 
 macro_rules! function_name {
     () => {{
@@ -105,7 +111,22 @@ fn rocie_server_args(paths: &Paths) -> [&OsStr; 4] {
 }
 
 impl TestEnv {
-    pub(crate) fn new(name: &'static str) -> TestEnv {
+    pub(crate) async fn new(name: &'static str) -> TestEnv {
+        let env = Self::new_no_login(name);
+
+         request!(
+            env,
+            provision(UserStub {
+                description: Some("Test user, used during test runs".to_string()),
+                name: "rocie".to_string(),
+                password: "server".to_string()
+            })
+        );
+
+        env
+    }
+
+    pub(crate) fn new_no_login(name: &'static str) -> TestEnv {
         let test_dir = test_dir(name);
 
         let paths = prepare_files_and_dirs(&test_dir)