Example #1
0
 def test_delete_comment(self):
     ref = 'NCC-74656'
     email = '*****@*****.**'
     c = store.create_comment(ref, email, 'Guest', 'Hello!', '127.0.0.1', True)
     self.assertEquals(email, c.email)
     # delete by reference key:
     store.delete_all_comments(ref)
     # comment still here:
     cs = store.get_all_comments(ref)
     self.assertEquals(1, len(cs))
     self.assertEquals(c.id, cs[0].id)
     # cron-delete is a real deletion:
     store.cron_delete_all_comments(ref)
     self.assertEquals(0, len(store.get_all_comments(ref)))
 def test_delete_comment(self):
     ref = 'NCC-74656'
     email = '*****@*****.**'
     c = store.create_comment(ref, email, 'Guest', 'Hello!', '127.0.0.1',
                              True)
     self.assertEquals(email, c.email)
     # delete by reference key:
     store.delete_all_comments(ref)
     # comment still here:
     cs = store.get_all_comments(ref)
     self.assertEquals(1, len(cs))
     self.assertEquals(c.id, cs[0].id)
     # cron-delete is a real deletion:
     store.cron_delete_all_comments(ref)
     self.assertEquals(0, len(store.get_all_comments(ref)))
Example #3
0
 def test_get_comments(self):
     ref = 'key-ABC-999-KDE-010-USS'
     email = '*****@*****.**'
     for i in range(10):
         store.create_comment(ref, email % i, 'Guest-%s' % i, 'No. %s' % i, '127.0.0.1', True)
     all = store.get_all_comments(ref)
     self.assertEquals(10, len(all))
     for i in range(10):
         self.assertEquals(email % i, all[i].email)
 def test_get_comments(self):
     ref = 'key-ABC-999-KDE-010-USS'
     email = '*****@*****.**'
     for i in range(10):
         store.create_comment(ref, email % i, 'Guest-%s' % i, 'No. %s' % i,
                              '127.0.0.1', True)
     all = store.get_all_comments(ref)
     self.assertEquals(10, len(all))
     for i in range(10):
         self.assertEquals(email % i, all[i].email)
Example #5
0
def get_post(key):
    '''
    Show a single published post.
    
    Args:
        key: post key as string.
    '''
    post = model.get_post(key)
    if post is None:
        raise NotFoundError()
    return {
        '__theme__': True,
        '__view__': 'post',
        '__title__': post.title,
        'post': post,
        'comments': store.get_all_comments(post.id),
    }
Example #6
0
def get_post(key):
    '''
    Show a single published post.
    
    Args:
        key: post key as string.
    '''
    post = model.get_post(key)
    if post is None:
        raise NotFoundError()
    return {
            '__theme__' : True,
            '__view__' : 'post',
            '__title__' : post.title,
            'post' : post,
            'comments' : store.get_all_comments(post.id),
    }