def test_topic_update_read(database, user, topic):
 forumsread = ForumsRead.query.filter((ForumsRead.user_id == user.id), (ForumsRead.forum_id == topic.forum_id)).first()
 with current_app.test_request_context():
  login_user(user)
  assert current_user.is_authenticated
  assert topic.update_read(current_user, topic.forum, forumsread)
  assert (not topic.update_read(current_user, topic.forum, forumsread))
  post = Post(content='Test Content')
  post.save(topic=topic, user=user)
  forumsread = ForumsRead.query.filter((ForumsRead.user_id == user.id), (ForumsRead.forum_id == topic.forum_id)).first()
  flaskbb_config['TRACKER_LENGTH'] = 0
  assert (not topic.update_read(current_user, topic.forum, forumsread))
  flaskbb_config['TRACKER_LENGTH'] = 1
  assert topic.update_read(current_user, topic.forum, forumsread)
  logout_user()
  assert (not current_user.is_authenticated)
  assert (not topic.update_read(current_user, topic.forum, forumsread))

def test_topic_update_read ( database , user , topic ) : forumsread = ForumsRead . query . filter ( ( ForumsRead . user_id == user . id ) , ( ForumsRead . forum_id == topic . forum_id ) ) . first ( ) with current_app . test_request_context ( ) : login_user ( user ) assert current_user . is_authenticated assert topic . update_read ( current_user , topic . forum , forumsread ) assert ( not topic . update_read ( current_user , topic . forum , forumsread ) ) post = Post ( content = 'Test Content' ) post . save ( topic = topic , user = user ) forumsread = ForumsRead . query . filter ( ( ForumsRead . user_id == user . id ) , ( ForumsRead . forum_id == topic . forum_id ) ) . first ( ) flaskbb_config [ 'TRACKER_LENGTH' ] = 0 assert ( not topic . update_read ( current_user , topic . forum , forumsread ) ) flaskbb_config [ 'TRACKER_LENGTH' ] = 1 assert topic . update_read ( current_user , topic . forum , forumsread ) logout_user ( ) assert ( not current_user . is_authenticated ) assert ( not topic . update_read ( current_user , topic . forum , forumsread ) )
tests the update read method if the topic is unread/read .