示例#1
0
    def test_page_parent(self):
        parent_page = WordPressPage()
        parent_page.title = 'Parent page'
        parent_page.content = 'This is the parent page'
        parent_page.id = self.client.call(posts.NewPost(parent_page))
        self.assertTrue(parent_page.id)

        child_page = WordPressPage()
        child_page.title = 'Child page'
        child_page.content = 'This is the child page'
        child_page.parent_id = parent_page.id
        child_page.id = self.client.call(posts.NewPost(child_page))
        self.assertTrue(child_page.id)

        # re-fetch to confirm parent_id worked
        child_page2 = self.client.call(posts.GetPost(child_page.id))
        self.assertTrue(child_page2)
        self.assertEquals(child_page.parent_id, child_page2.parent_id)

        # cleanup
        self.client.call(posts.DeletePost(parent_page.id))
        self.client.call(posts.DeletePost(child_page.id))
    def test_page_parent(self):
        parent_page = WordPressPage()
        parent_page.title = 'Parent page'
        parent_page.content = 'This is the parent page'
        parent_page.id = self.client.call(posts.NewPost(parent_page))
        self.assertTrue(parent_page.id)

        child_page = WordPressPage()
        child_page.title = 'Child page'
        child_page.content = 'This is the child page'
        child_page.parent_id = parent_page.id
        child_page.id = self.client.call(posts.NewPost(child_page))
        self.assertTrue(child_page.id)

        # re-fetch to confirm parent_id worked
        child_page2 = self.client.call(posts.GetPost(child_page.id))
        self.assertTrue(child_page2)
        self.assertEquals(child_page.parent_id, child_page2.parent_id)

        # cleanup
        self.client.call(posts.DeletePost(parent_page.id))
        self.client.call(posts.DeletePost(child_page.id))