-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2, tests: server_app sign_up test, part 2
- Loading branch information
1 parent
8d68e90
commit 6cb67ea
Showing
9 changed files
with
75 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
pub fn qwe() { | ||
println!("qwe"); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
mod common; | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use meta_secret_core::node::{ | ||
server::{ | ||
request::{GlobalIndexRequest, SyncRequest}, | ||
server_app::ServerApp | ||
}, | ||
db::{ | ||
descriptors::global_index::GlobalIndexDescriptor, | ||
descriptors::object_descriptor::ToObjectDescriptor, | ||
events::object_id::ObjectId, | ||
in_mem_db::InMemKvLogEventRepo | ||
} | ||
}; | ||
use std::sync::Arc; | ||
use meta_secret_core::crypto::keys::{KeyManager, OpenBox}; | ||
use meta_secret_core::node::common::model::device::{DeviceData, DeviceName}; | ||
|
||
|
||
#[tokio::test] | ||
pub async fn test_server_app() -> anyhow::Result<()> { | ||
let repo = Arc::new(InMemKvLogEventRepo::default()); | ||
|
||
let server_app = ServerApp::init(repo.clone()).await?; | ||
|
||
let client_device = { | ||
let secret_box = KeyManager::generate_secret_box(); | ||
let open_box = OpenBox::from(&secret_box); | ||
DeviceData::from(DeviceName::from("test_device"), open_box) | ||
}; | ||
|
||
let sync_request = SyncRequest::GlobalIndex(GlobalIndexRequest { | ||
sender: client_device, | ||
global_index: ObjectId::unit(GlobalIndexDescriptor::Index.to_obj_desc()) | ||
}); | ||
|
||
let events = server_app | ||
.handle_sync_request(sync_request) | ||
.await; | ||
|
||
for event in events { | ||
println!("Event: {}", serde_json::to_string(&event).unwrap()); | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |