(&mut self, event: E)
+ where
+ E: Eq + Hash + Debug + Clone + Display,
+ {
+ init_sdk();
+ self.context().request = Some(ModuleRequest::new(event));
+ }
+
fn set_payload(&mut self, payload: P)
where
P: ToBytes,
{
let bytes = payload.into_bytes().unwrap();
- let mut module_request = self.context().request.take().unwrap();
+ let module_request = self.context().request.take().unwrap();
self.context().request = Some(module_request.payload(bytes));
}
@@ -173,4 +162,23 @@ pub trait TesterTrait {
.unwrap()
.into_inner()
}
+
+ fn login(&self) -> UserDetail {
+ init_sdk();
+ let _ = EventDispatch::sync_send(ModuleRequest::new(SignOut));
+ let request = SignInRequest {
+ email: valid_email(),
+ password: valid_password(),
+ };
+
+ let mut tester = Tester::::new(SignIn);
+ tester.set_request(request);
+ tester.sync_send();
+ tester.parse::()
+ }
+
+ fn logout(&self) {
+ init_sdk();
+ let _ = EventDispatch::sync_send(ModuleRequest::new(SignOut));
+ }
}
diff --git a/rust-lib/flowy-user/tests/event/helper.rs b/rust-lib/flowy-user/tests/event/helper.rs
index 692d6c2d42..c415725bf6 100644
--- a/rust-lib/flowy-user/tests/event/helper.rs
+++ b/rust-lib/flowy-user/tests/event/helper.rs
@@ -1,7 +1,4 @@
-use flowy_test::prelude::TestBuilder;
-use flowy_user::errors::UserError;
-
-pub type UserTestBuilder = TestBuilder;
+pub use flowy_test::builder::UserTestBuilder;
pub(crate) fn invalid_email_test_case() -> Vec {
// https://gist.github.com/cjaoude/fd9910626629b53c4d25
diff --git a/rust-lib/flowy-user/tests/event/sign_in_test.rs b/rust-lib/flowy-user/tests/event/sign_in_test.rs
index 67817f874c..2d2793354d 100644
--- a/rust-lib/flowy-user/tests/event/sign_in_test.rs
+++ b/rust-lib/flowy-user/tests/event/sign_in_test.rs
@@ -1,5 +1,4 @@
use crate::helper::*;
-
use flowy_user::{errors::UserErrorCode, event::UserEvent::*, prelude::*};
use serial_test::*;
diff --git a/rust-lib/flowy-user/tests/event/sign_up_test.rs b/rust-lib/flowy-user/tests/event/sign_up_test.rs
index e08b5dd061..9a1427491d 100644
--- a/rust-lib/flowy-user/tests/event/sign_up_test.rs
+++ b/rust-lib/flowy-user/tests/event/sign_up_test.rs
@@ -1,5 +1,4 @@
use crate::helper::*;
-
use flowy_user::{errors::*, event::UserEvent::*, prelude::*};
use serial_test::*;
diff --git a/rust-lib/flowy-workspace/tests/event/helper.rs b/rust-lib/flowy-workspace/tests/event/helper.rs
index c4ecbb3435..9631890bfa 100644
--- a/rust-lib/flowy-workspace/tests/event/helper.rs
+++ b/rust-lib/flowy-workspace/tests/event/helper.rs
@@ -1,7 +1,4 @@
-use flowy_test::prelude::TestBuilder;
-use flowy_workspace::errors::WorkspaceError;
-
-pub type WorkspaceTestBuilder = TestBuilder;
+pub use flowy_test::builder::WorkspaceTestBuilder;
pub(crate) fn invalid_workspace_name_test_case() -> Vec {
vec!["", "1234".repeat(100).as_str()]