def test_page_lifecycle(self): page = WordPressPage() page.title = 'Test Page' page.description = 'This is my test page.' # create the page page_id = self.client.call(pages.NewPage(page, True)) self.assertTrue(page_id) # fetch the newly created page page2 = self.client.call(pages.GetPage(page_id)) self.assertTrue(isinstance(page2, WordPressPage)) self.assertEqual(str(page2.id), page_id) # edit the page page2.description += '<br><b>Updated:</b> This page has been updated.' response = self.client.call(pages.EditPage(page_id, page2, True)) self.assertTrue(response) # delete the page response = self.client.call(pages.DeletePage(page_id)) self.assertTrue(response)
def test_page_lifecycle(self): page = WordPressPage() page.title = 'Test Page' page.content = 'This is my test page.' # create the page page_id = self.client.call(posts.NewPost(page)) self.assertTrue(page_id) # fetch the newly created page page2 = self.client.call( posts.GetPost(page_id, results_class=WordPressPage)) self.assertTrue(isinstance(page2, WordPressPage)) self.assertEqual(str(page2.id), page_id) # edit the page page2.content += '<br><b>Updated:</b> This page has been updated.' response = self.client.call(posts.EditPost(page_id, page2)) self.assertTrue(response) # delete the page response = self.client.call(posts.DeletePost(page_id)) self.assertTrue(response)
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_repr(self): page = WordPressPage() repr(page)