def test_updating(self):
        """Test the blog post's fields' correctness after updating a post and
        test the proper creation and automatic tidying of tags and tag
        mappings and category associations"""
        post = self.test_creation()
        datetime = post.datetime
        
        self.update_post(title='cool', markup='## Title', slug=post.slug, 
            tags=['django'], comments_allowed=True, visible=True)
        updated_post = Post.query.get(1)
        
        assert_equal(updated_post.title, 'cool')
        assert_equal(updated_post.markup, '## Title')
        assert_true(updated_post.comments_allowed)
        assert_true(updated_post.visible)
        assert_equal(updated_post.slug, 'cool')
        assert '<h2>Title</h2>' in updated_post.html
        assert_equal(updated_post.datetime, datetime)
        assert_equal([x.name for x in updated_post.tags], ['django'])
        
        # Expect two rows in the posts table because two posts were
        # created and one updated. Expect only one row in the tags table 
        # because only 'django' is used as a tag.
        
        assert_equal(Post.query.count(), 2)
        assert_equal(Tag.query.count(), 1)
        
        # Because there are two post with a tag expect two rows
        # in the post_tag association table
        
        assert_equal(db.session.query(post_tags).count(), 2)
        
        # Because there is no post in a category anymore expect not rows
        # in the post_categories association table
        
        assert_equal(db.session.query(post_categories).count(), 0)
dataset/ETHPy150Open eugenkiss/Simblin/test/test_views.py/TestPost.test_updating/original