Esempio n. 1
0
    def test_edit_post(self):
        post = post_structure(self.nodetype_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)

        nodetype = Nodetype.objects.get(pk=new_post_id)
        self.assertEquals(nodetype.title, self.nodetype_2.title)
        self.assertEquals(nodetype.content, self.nodetype_2.html_content)
        self.assertEquals(nodetype.excerpt, self.nodetype_2.excerpt)
        self.assertEquals(nodetype.slug, self.nodetype_2.slug)
        self.assertEquals(nodetype.status, DRAFT)
        self.assertEquals(nodetype.password, self.nodetype_2.password)
        self.assertEquals(nodetype.comment_enabled, True)
        self.assertEquals(nodetype.pingback_enabled, True)
        self.assertEquals(nodetype.metatypes.count(), 1)
        self.assertEquals(nodetype.authors.count(), 1)
        self.assertEquals(nodetype.authors.all()[0], self.webmaster)
        self.assertEquals(nodetype.creation_date,
                          self.nodetype_2.creation_date)

        nodetype.title = 'Title edited'
        nodetype.creation_date = datetime(2000, 1, 1)
        post = post_structure(nodetype, self.site)
        post['metatypes'] = ''
        post['description'] = 'Content edited'
        post['mt_excerpt'] = 'Content edited'
        post['wp_slug'] = 'slug-edited'
        post['wp_password'] = '******'
        post['mt_allow_comments'] = 2
        post['mt_allow_pings'] = 0

        response = self.server.metaWeblog.editPost(new_post_id, 'webmaster',
                                                   'password', post, 1)
        self.assertEquals(response, True)
        nodetype = Nodetype.objects.get(pk=new_post_id)
        self.assertEquals(nodetype.title, post['title'])
        self.assertEquals(nodetype.content, post['description'])
        self.assertEquals(nodetype.excerpt, post['mt_excerpt'])
        self.assertEquals(nodetype.slug, 'slug-edited')
        self.assertEquals(nodetype.status, PUBLISHED)
        self.assertEquals(nodetype.password, 'password')
        self.assertEquals(nodetype.comment_enabled, False)
        self.assertEquals(nodetype.pingback_enabled, False)
        self.assertEquals(nodetype.metatypes.count(), 0)
        self.assertEquals(nodetype.creation_date, datetime(2000, 1, 1))

        del post['dateCreated']
        post['wp_author_id'] = self.contributor.pk

        response = self.server.metaWeblog.editPost(new_post_id, 'webmaster',
                                                   'password', post, 1)
        nodetype = Nodetype.objects.get(pk=new_post_id)
        self.assertEquals(nodetype.authors.count(), 1)
        self.assertEquals(nodetype.authors.all()[0], self.contributor)
        self.assertEquals(nodetype.creation_date, datetime(2000, 1, 1))
Esempio n. 2
0
    def test_edit_post(self):
        post = post_structure(self.objecttype_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)

        objecttype = Objecttype.objects.get(pk=new_post_id)
        self.assertEquals(objecttype.title, self.objecttype_2.title)
        self.assertEquals(objecttype.content, self.objecttype_2.html_content)
        self.assertEquals(objecttype.excerpt, self.objecttype_2.excerpt)
        self.assertEquals(objecttype.slug, self.objecttype_2.slug)
        self.assertEquals(objecttype.status, DRAFT)
        self.assertEquals(objecttype.password, self.objecttype_2.password)
        self.assertEquals(objecttype.comment_enabled, True)
        self.assertEquals(objecttype.pingback_enabled, True)
        self.assertEquals(objecttype.metatypes.count(), 1)
        self.assertEquals(objecttype.authors.count(), 1)
        self.assertEquals(objecttype.authors.all()[0], self.webmaster)
        self.assertEquals(objecttype.creation_date, self.objecttype_2.creation_date)

        objecttype.title = 'Title edited'
        objecttype.creation_date = datetime(2000, 1, 1)
        post = post_structure(objecttype, self.site)
        post['metatypes'] = ''
        post['description'] = 'Content edited'
        post['mt_excerpt'] = 'Content edited'
        post['wp_slug'] = 'slug-edited'
        post['wp_password'] = '******'
        post['mt_allow_comments'] = 2
        post['mt_allow_pings'] = 0

        response = self.server.metaWeblog.editPost(
            new_post_id, 'webmaster', 'password', post, 1)
        self.assertEquals(response, True)
        objecttype = Objecttype.objects.get(pk=new_post_id)
        self.assertEquals(objecttype.title, post['title'])
        self.assertEquals(objecttype.content, post['description'])
        self.assertEquals(objecttype.excerpt, post['mt_excerpt'])
        self.assertEquals(objecttype.slug, 'slug-edited')
        self.assertEquals(objecttype.status, PUBLISHED)
        self.assertEquals(objecttype.password, 'password')
        self.assertEquals(objecttype.comment_enabled, False)
        self.assertEquals(objecttype.pingback_enabled, False)
        self.assertEquals(objecttype.metatypes.count(), 0)
        self.assertEquals(objecttype.creation_date, datetime(2000, 1, 1))

        del post['dateCreated']
        post['wp_author_id'] = self.contributor.pk

        response = self.server.metaWeblog.editPost(
            new_post_id, 'webmaster', 'password', post, 1)
        objecttype = Objecttype.objects.get(pk=new_post_id)
        self.assertEquals(objecttype.authors.count(), 1)
        self.assertEquals(objecttype.authors.all()[0], self.contributor)
        self.assertEquals(objecttype.creation_date, datetime(2000, 1, 1))
Esempio n. 3
0
    def test_edit_post(self):
        post = post_structure(self.nodetype_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)

        nodetype = Nodetype.objects.get(pk=new_post_id)
        self.assertEquals(nodetype.title, self.nodetype_2.title)
        self.assertEquals(nodetype.content, self.nodetype_2.html_content)
        self.assertEquals(nodetype.excerpt, self.nodetype_2.excerpt)
        self.assertEquals(nodetype.slug, self.nodetype_2.slug)
        self.assertEquals(nodetype.status, DRAFT)
        self.assertEquals(nodetype.password, self.nodetype_2.password)
        self.assertEquals(nodetype.comment_enabled, True)
        self.assertEquals(nodetype.pingback_enabled, True)
        self.assertEquals(nodetype.metatypes.count(), 1)
        self.assertEquals(nodetype.authors.count(), 1)
        self.assertEquals(nodetype.authors.all()[0], self.webmaster)
        self.assertEquals(nodetype.creation_date, self.nodetype_2.creation_date)

        nodetype.title = "Title edited"
        nodetype.creation_date = datetime(2000, 1, 1)
        post = post_structure(nodetype, self.site)
        post["metatypes"] = ""
        post["description"] = "Content edited"
        post["mt_excerpt"] = "Content edited"
        post["wp_slug"] = "slug-edited"
        post["wp_password"] = "******"
        post["mt_allow_comments"] = 2
        post["mt_allow_pings"] = 0

        response = self.server.metaWeblog.editPost(new_post_id, "webmaster", "password", post, 1)
        self.assertEquals(response, True)
        nodetype = Nodetype.objects.get(pk=new_post_id)
        self.assertEquals(nodetype.title, post["title"])
        self.assertEquals(nodetype.content, post["description"])
        self.assertEquals(nodetype.excerpt, post["mt_excerpt"])
        self.assertEquals(nodetype.slug, "slug-edited")
        self.assertEquals(nodetype.status, PUBLISHED)
        self.assertEquals(nodetype.password, "password")
        self.assertEquals(nodetype.comment_enabled, False)
        self.assertEquals(nodetype.pingback_enabled, False)
        self.assertEquals(nodetype.metatypes.count(), 0)
        self.assertEquals(nodetype.creation_date, datetime(2000, 1, 1))

        del post["dateCreated"]
        post["wp_author_id"] = self.contributor.pk

        response = self.server.metaWeblog.editPost(new_post_id, "webmaster", "password", post, 1)
        nodetype = Nodetype.objects.get(pk=new_post_id)
        self.assertEquals(nodetype.authors.count(), 1)
        self.assertEquals(nodetype.authors.all()[0], self.contributor)
        self.assertEquals(nodetype.creation_date, datetime(2000, 1, 1))
Esempio n. 4
0
 def test_new_post(self):
     post = post_structure(self.nodetype_2, self.site)
     self.assertRaises(Fault, self.server.metaWeblog.newPost, 1, "contributor", "password", post, 1)
     self.assertEquals(Nodetype.objects.count(), 2)
     self.assertEquals(Nodetype.published.count(), 1)
     self.server.metaWeblog.newPost(1, "webmaster", "password", post, 1)
     self.assertEquals(Nodetype.objects.count(), 3)
     self.assertEquals(Nodetype.published.count(), 2)
     del post["dateCreated"]
     post["wp_author_id"] = self.contributor.pk
     self.server.metaWeblog.newPost(1, "webmaster", "password", post, 0)
     self.assertEquals(Nodetype.objects.count(), 4)
     self.assertEquals(Nodetype.published.count(), 2)
Esempio n. 5
0
 def test_new_post(self):
     post = post_structure(self.nodetype_2, self.site)
     self.assertRaises(Fault, self.server.metaWeblog.newPost, 1,
                       'contributor', 'password', post, 1)
     self.assertEquals(Nodetype.objects.count(), 2)
     self.assertEquals(Nodetype.published.count(), 1)
     self.server.metaWeblog.newPost(1, 'webmaster', 'password', post, 1)
     self.assertEquals(Nodetype.objects.count(), 3)
     self.assertEquals(Nodetype.published.count(), 2)
     del post['dateCreated']
     post['wp_author_id'] = self.contributor.pk
     self.server.metaWeblog.newPost(1, 'webmaster', 'password', post, 0)
     self.assertEquals(Nodetype.objects.count(), 4)
     self.assertEquals(Nodetype.published.count(), 2)
Esempio n. 6
0
 def test_new_post(self):
     post = post_structure(self.objecttype_2, self.site)
     self.assertRaises(Fault, self.server.metaWeblog.newPost,
                       1, 'contributor', 'password', post, 1)
     self.assertEquals(Objecttype.objects.count(), 2)
     self.assertEquals(Objecttype.published.count(), 1)
     self.server.metaWeblog.newPost(
         1, 'webmaster', 'password', post, 1)
     self.assertEquals(Objecttype.objects.count(), 3)
     self.assertEquals(Objecttype.published.count(), 2)
     del post['dateCreated']
     post['wp_author_id'] = self.contributor.pk
     self.server.metaWeblog.newPost(
         1, 'webmaster', 'password', post, 0)
     self.assertEquals(Objecttype.objects.count(), 4)
     self.assertEquals(Objecttype.published.count(), 2)