2021-07-17 08:24:17 +08:00
|
|
|
pub mod builder;
|
2021-07-16 23:18:12 +08:00
|
|
|
mod helper;
|
|
|
|
|
2021-09-04 16:12:48 +08:00
|
|
|
use crate::helper::*;
|
2021-09-05 13:50:23 +08:00
|
|
|
use flowy_sdk::{FlowySDK, FlowySDKConfig};
|
2021-09-04 16:53:58 +08:00
|
|
|
use flowy_user::entities::UserProfile;
|
2021-07-06 14:14:47 +08:00
|
|
|
|
|
|
|
pub mod prelude {
|
2021-09-04 15:12:53 +08:00
|
|
|
pub use crate::{builder::*, helper::*, *};
|
2021-07-08 21:23:44 +08:00
|
|
|
pub use flowy_dispatch::prelude::*;
|
2021-07-06 14:14:47 +08:00
|
|
|
}
|
|
|
|
|
2021-09-04 15:12:53 +08:00
|
|
|
pub type FlowyTestSDK = FlowySDK;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
2021-09-04 16:12:48 +08:00
|
|
|
pub struct FlowyEnv {
|
|
|
|
pub sdk: FlowyTestSDK,
|
2021-09-04 16:53:58 +08:00
|
|
|
pub user: UserProfile,
|
2021-09-04 16:12:48 +08:00
|
|
|
pub password: String,
|
2021-09-04 15:12:53 +08:00
|
|
|
}
|
|
|
|
|
2021-09-04 16:12:48 +08:00
|
|
|
impl FlowyEnv {
|
|
|
|
pub fn setup() -> Self {
|
2021-09-27 23:23:23 +08:00
|
|
|
let host = "localhost";
|
|
|
|
let http_schema = "http";
|
|
|
|
let ws_schema = "ws";
|
|
|
|
|
|
|
|
let config = FlowySDKConfig::new(&root_dir(), host, http_schema, ws_schema).log_filter("debug");
|
|
|
|
let sdk = FlowySDK::new(config);
|
2021-09-04 16:12:48 +08:00
|
|
|
let result = sign_up(sdk.dispatch());
|
|
|
|
let env = Self {
|
|
|
|
sdk,
|
2021-09-04 16:53:58 +08:00
|
|
|
user: result.user_profile,
|
2021-09-04 16:12:48 +08:00
|
|
|
password: result.password,
|
|
|
|
};
|
|
|
|
env
|
2021-09-04 15:12:53 +08:00
|
|
|
}
|
|
|
|
|
2021-09-04 16:12:48 +08:00
|
|
|
pub fn sdk(&self) -> FlowyTestSDK { self.sdk.clone() }
|
2021-09-04 15:12:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn init_test_sdk() -> FlowyTestSDK {
|
2021-09-27 23:23:23 +08:00
|
|
|
let host = "localhost";
|
|
|
|
let http_schema = "http";
|
|
|
|
let ws_schema = "ws";
|
|
|
|
|
|
|
|
let config = FlowySDKConfig::new(&root_dir(), host, http_schema, ws_schema).log_filter("debug");
|
2021-09-05 13:50:23 +08:00
|
|
|
FlowySDK::new(config)
|
2021-07-06 14:14:47 +08:00
|
|
|
}
|