def test_topic_tracker_needs_update_cleared(database, user, topic):
 forumsread = ForumsRead.query.filter((ForumsRead.user_id == user.id), (ForumsRead.forum_id == topic.forum_id)).first()
 topicsread = TopicsRead.query.filter((TopicsRead.user_id == user.id), (TopicsRead.topic_id == topic.id)).first()
 with current_app.test_request_context():
  assert topic.tracker_needs_update(forumsread, topicsread)
  forumsread = ForumsRead()
  forumsread.user_id = user.id
  forumsread.forum_id = topic.forum_id
  forumsread.last_read = datetime.utcnow()
  forumsread.cleared = datetime.utcnow()
  forumsread.save()
  assert (not topic.tracker_needs_update(forumsread, topicsread))

def test_topic_tracker_needs_update_cleared ( database , user , topic ) : forumsread = ForumsRead . query . filter ( ( ForumsRead . user_id == user . id ) , ( ForumsRead . forum_id == topic . forum_id ) ) . first ( ) topicsread = TopicsRead . query . filter ( ( TopicsRead . user_id == user . id ) , ( TopicsRead . topic_id == topic . id ) ) . first ( ) with current_app . test_request_context ( ) : assert topic . tracker_needs_update ( forumsread , topicsread ) forumsread = ForumsRead ( ) forumsread . user_id = user . id forumsread . forum_id = topic . forum_id forumsread . last_read = datetime . utcnow ( ) forumsread . cleared = datetime . utcnow ( ) forumsread . save ( ) assert ( not topic . tracker_needs_update ( forumsread , topicsread ) )
tests if the topicsread needs an update if the forum has been marked as cleared .