def test_edit_post(self): post = post_structure(self.entry_2, self.site) self.assertRaises(Fault, self.server.metaWeblog.editPost, 1, 'contributor', 'password', post, 1) new_post_id = self.server.metaWeblog.newPost( 1, 'webmaster', 'password', post, 0) entry = Entry.objects.get(pk=new_post_id) self.assertEquals(entry.title, self.entry_2.title) self.assertEquals(entry.content, self.entry_2.html_content) self.assertEquals(entry.excerpt, self.entry_2.content) self.assertEquals(entry.slug, self.entry_2.slug) self.assertEquals(entry.status, STATUS_CHOICES['Draft']) self.assertEquals(entry.creation_date, self.entry_2.creation_date) entry.title = 'Title edited' entry.creation_date = datetime(2000, 1, 1) post = post_structure(entry, self.site) post['description'] = 'Content edited' post['wp_slug'] = 'slug-edited' response = self.server.metaWeblog.editPost( new_post_id, 'webmaster', 'password', post, 1) self.assertEquals(response, True) entry = Entry.objects.get(pk=new_post_id) self.assertEquals(entry.title, post['title']) self.assertEquals(entry.content, post['description']) self.assertEquals(entry.excerpt, post['description']) self.assertEquals(entry.slug, 'slug-edited') self.assertEquals(entry.status, STATUS_CHOICES['Published']) self.assertEquals(entry.creation_date, datetime(2000, 1, 1))
def test_new_post(self): post = post_structure(self.entry_2, self.site) self.assertRaises(Fault, self.server.metaWeblog.newPost, 1, 'contributor', 'password', post, 1) self.assertEquals(Entry.objects.count(), 2) self.assertEquals(Entry.published.count(), 1) new_post_id = self.server.metaWeblog.newPost( 1, 'webmaster', 'password', post, 1) self.assertEquals(Entry.objects.count(), 3) self.assertEquals(Entry.published.count(), 2) new_post_id = self.server.metaWeblog.newPost( 1, 'webmaster', 'password', post, 0) self.assertEquals(Entry.objects.count(), 4) self.assertEquals(Entry.published.count(), 2)