def test_category_post(self): # create a test post post = WordPressPost() post.title = 'Test Post' post.slug = 'test-post' post.user = self.userid post.id = self.client.call(posts.NewPost(post)) # create a test category cat = WordPressTerm() cat.name = 'Test Category' cat.taxonomy = 'category' cat.id = self.client.call(taxonomies.NewTerm(cat)) # set category on post try: post.terms = [cat] response = self.client.call(posts.EditPost(post.id, post)) self.assertTrue(response) # fetch categories for the post to verify post2 = self.client.call(posts.GetPost(post.id, ['terms'])) post_cats = post2.terms self.assert_list_of_classes(post_cats, WordPressTerm) self.assertEqual(post_cats[0].id, cat.id) finally: # cleanup self.client.call(taxonomies.DeleteTerm(cat.taxonomy, cat.id)) self.client.call(posts.DeletePost(post.id))