Unify some testing interfaces

This tidies up our testing tools a little bit.  We had several
functions which through various changes ended up doing the same and
some more which did very similar stuff, so I merged them to have
things simpler.  Also moved towards methods on the TestContext struct
while cleaning this up anyway, seems like this structure is going to
stay around for a bit anyway.

The intersting change is in `test_utils.rs`, everything else is just
updating callers.  A few tests used example.org which I moved to
example.com to be able to re-use more configuration of the test
context.
This commit is contained in:
Floris Bruynooghe
2020-06-19 20:23:05 +02:00
parent 73412db267
commit 9d7b756ddb
24 changed files with 253 additions and 250 deletions

View File

@@ -428,7 +428,7 @@ mod tests {
#[async_std::test]
async fn test_try_load() {
let t = dummy_context().await;
let t = TestContext::new().await;
let chat_id1 = create_group_chat(&t.ctx, VerifiedStatus::Unverified, "a chat")
.await
.unwrap();
@@ -476,7 +476,7 @@ mod tests {
#[async_std::test]
async fn test_sort_self_talk_up_on_forward() {
let t = dummy_context().await;
let t = TestContext::new().await;
t.ctx.update_device_chats().await.unwrap();
create_group_chat(&t.ctx, VerifiedStatus::Unverified, "a chat")
.await
@@ -501,7 +501,7 @@ mod tests {
#[async_std::test]
async fn test_search_special_chat_names() {
let t = dummy_context().await;
let t = TestContext::new().await;
t.ctx.update_device_chats().await.unwrap();
let chats = Chatlist::try_load(&t.ctx, 0, Some("t-1234-s"), None)
@@ -534,7 +534,7 @@ mod tests {
#[async_std::test]
async fn test_get_summary_unwrap() {
let t = dummy_context().await;
let t = TestContext::new().await;
let chat_id1 = create_group_chat(&t.ctx, VerifiedStatus::Unverified, "a chat")
.await
.unwrap();