本文整理汇总了Python中the_tale.forum.prototypes.PostPrototype._db_get_object方法的典型用法代码示例。如果您正苦于以下问题:Python PostPrototype._db_get_object方法的具体用法?Python PostPrototype._db_get_object怎么用?Python PostPrototype._db_get_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.forum.prototypes.PostPrototype
的用法示例。
在下文中一共展示了PostPrototype._db_get_object方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_automatic_update_on_post_deleting
# 需要导入模块: from the_tale.forum.prototypes import PostPrototype [as 别名]
# 或者: from the_tale.forum.prototypes.PostPrototype import _db_get_object [as 别名]
def test_automatic_update_on_post_deleting(self):
old_time = datetime.datetime.now()
self.test_automatic_update_on_post_creating()
PostPrototype._db_get_object(1).delete(self.checked_account)
self.thread.update()
self.assertEqual(self.thread.posts_count, 1)
self.assertEqual(self.thread._model.last_poster.id, self.account.id)
self.assertTrue(self.thread.updated_at < old_time)
示例2: test_create_post_success
# 需要导入模块: from the_tale.forum.prototypes import PostPrototype [as 别名]
# 或者: from the_tale.forum.prototypes.PostPrototype import _db_get_object [as 别名]
def test_create_post_success(self):
self.assertEqual(ThreadReadInfoPrototype._db_count(), 0)
response = self.client.post(url('forum:threads:create-post', self.thread3.id), {'text': 'thread3-test-post'})
post = PostPrototype._db_get_object(4)
self.check_ajax_ok(response, data={'next_url': url('forum:threads:show', self.thread3.id) + ('?page=1#m%d' % post.id)})
self.assertEqual(Post.objects.all().count(), 5)
self.assertEqual(ThreadReadInfoPrototype._db_count(), 1)
self.assertEqual(ThreadReadInfoPrototype._db_get_object(0).thread_id, self.thread3.id)
示例3: test_update_thread_on_delete
# 需要导入模块: from the_tale.forum.prototypes import PostPrototype [as 别名]
# 或者: from the_tale.forum.prototypes.PostPrototype import _db_get_object [as 别名]
def test_update_thread_on_delete(self):
with mock.patch('the_tale.forum.prototypes.ThreadPrototype.update') as thread_update:
PostPrototype._db_get_object(0).delete(self.checked_account)
self.assertEqual(thread_update.call_count, 1)