|
1 | 1 | use super::*;
|
2 | 2 | use crate::chat::Chat;
|
3 | 3 | use crate::mimeparser::SystemMessage;
|
4 |
| -use crate::test_utils::{get_chat_msg, TestContextManager}; |
| 4 | +use crate::test_utils::{get_chat_msg, TestContext, TestContextManager}; |
5 | 5 |
|
6 | 6 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
7 | 7 | async fn test_send_self_report() -> Result<()> {
|
8 |
| - let mut tcm = TestContextManager::new(); |
9 |
| - let alice = &tcm.alice().await; |
10 |
| - let bob = &tcm.bob().await; |
| 8 | + let alice = &TestContext::new_alice().await; |
11 | 9 |
|
12 | 10 | alice.set_config_bool(Config::SelfReporting, true).await?;
|
13 | 11 |
|
@@ -35,12 +33,25 @@ async fn test_send_self_report() -> Result<()> {
|
35 | 33 |
|
36 | 34 | assert_eq!(maybe_send_self_report(alice).await?, None);
|
37 | 35 |
|
38 |
| - tcm.send_recv_accept(bob, alice, "Hi!").await; |
| 36 | + Ok(()) |
| 37 | +} |
| 38 | + |
| 39 | +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 40 | +async fn test_self_report_one_contact() -> Result<()> { |
| 41 | + let mut tcm = TestContextManager::new(); |
| 42 | + let alice = &tcm.alice().await; |
| 43 | + let bob = &tcm.bob().await; |
| 44 | + alice.set_config_bool(Config::SelfReporting, true).await?; |
39 | 45 |
|
40 | 46 | let report = get_self_report(alice).await?;
|
| 47 | + let r: serde_json::Value = serde_json::from_str(&report)?; |
41 | 48 |
|
| 49 | + tcm.send_recv_accept(bob, alice, "Hi!").await; |
| 50 | + |
| 51 | + let report = get_self_report(alice).await?; |
42 | 52 | println!("\nWith Bob:\n{report}\n");
|
43 | 53 | let r2: serde_json::Value = serde_json::from_str(&report)?;
|
| 54 | + |
44 | 55 | assert_eq!(
|
45 | 56 | r.get("key_created").unwrap(),
|
46 | 57 | r2.get("key_created").unwrap()
|
|
0 commit comments