def test_post_snapshotting(mock_reddit):
    r = mock_reddit.return_value
    patch('praw.')

    yesterday_posts = 10
    today_posts = 20

    controller, today_post_list, comment_counter = setup_comment_monitoring(r, yesterday_posts, today_posts)

    posts = controller.identify_posts_that_need_snapshotting()
    assert len(posts) == today_posts

    assert db_session.query(Post).outerjoin(
           ExperimentThing, Post.id == ExperimentThing.id).filter(
           ExperimentThing.id==None,
           Post.id.in_([x.id for x in posts])).count() == 0

    assert db_session.query(Post).outerjoin(
           ExperimentThing, Post.id == ExperimentThing.id).filter(
           Post.id.in_([x.id for x in posts])).count() == len(posts)

    # now confirm that it doesn't add more ExperimentThings if we run it a second time
    posts = controller.identify_posts_that_need_snapshotting()
    assert len(posts) == today_posts

    assert db_session.query(Post).outerjoin(
           ExperimentThing, Post.id == ExperimentThing.id).filter(
           ExperimentThing.id==None,
           Post.id.in_([x.id for x in posts])).count() == 0

    assert db_session.query(Post).outerjoin(
           ExperimentThing, Post.id == ExperimentThing.id).filter(
           Post.id.in_([x.id for x in posts])).count() == len(posts)