From 1538684c6c02eac9e25d2f6b89dfd1c08c5c6aa1 Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Tue, 7 Jan 2020 03:56:03 +0100 Subject: [PATCH] simplify test code --- src/chat.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index d9c6c4a56..6d5005d5f 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -2868,15 +2868,13 @@ mod tests { false ); // Timed in the future - let current_timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap() + Duration::from_secs(3600); - set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(current_timestamp.as_secs() as i64)).unwrap(); + set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(time() + 3600)).unwrap(); assert_eq!( Chat::load_from_db(&t.ctx, chat_id).unwrap().is_muted(), true ); // Time in the past - let past_timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap() - Duration::from_secs(3600); - set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(past_timestamp.as_secs() as i64)).unwrap(); + set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(time() - 3600)).unwrap(); assert_eq!( Chat::load_from_db(&t.ctx, chat_id).unwrap().is_muted(), false