Exemplo n.º 1
0
def test_load_from_db():
    '''
    Make sure we can save and rehydrate
    a post instance from the database.
    '''
    post = Post(content='test this out',
                title='super awesome title',
                author = author,
                prefix=prefix,
                db=db)
    post.save()
    saved = Post(db=db).load(post.url + '.json')
    assert saved == post
Exemplo n.º 2
0
def test_post_save():
    '''
    saving a post should:
    1. update feeds (tested in feed test module)
    2. create a json entry at the url
    3. create an html fragment entry at the url.html
    '''
    content = 'check it'
    post = Post(content=content, prefix=prefix, db=db, author=author)
    post.save()
    newpost = Post(db=db).load(post.url + '.json')
    assert newpost == post
    assert post.fragment == db.get(post.url + '.html')
Exemplo n.º 3
0
def test_load_from_db():
    '''
    Make sure we can save and rehydrate
    a post instance from the database.
    '''
    post = Post(content='test this out',
                title='super awesome title',
                author=author,
                prefix=prefix,
                db=db)
    post.save()
    saved = Post(db=db).load(post.url + '.json')
    assert saved == post
Exemplo n.º 4
0
def test_post_save():
    '''
    saving a post should:
    1. update feeds (tested in feed test module)
    2. create a json entry at the url
    3. create an html fragment entry at the url.html
    '''
    content = 'check it'
    post = Post(content=content, prefix=prefix, db=db, author=author)
    post.save()
    newpost = Post(db=db).load(post.url + '.json')
    assert newpost == post
    assert post.fragment == db.get(post.url + '.html')
Exemplo n.º 5
0
def test_new_post_updates():
    #creating a new post updates lense
    #feed and author feed
    lense = test_create_lense()
    assert len(lense.feed.entries) == 0
    assert len(lense.author.feed.entries) == 0
    post = Post('test this shit out',
                prefix='/sean/public/%s/posts' % lense.name,
                author=lense.author,
                lense=lense)
    post.save(db=db)
    lense.update()
    assert len(lense.feed.entries) == 1
    assert len(lense.author.feed.entries) == 1
    post.delete()
    lense.update()
    assert len(lense.feed.entries) == 0
    assert len(lense.author.feed.entries) == 0
Exemplo n.º 6
0
def test_new_post_updates():
    #creating a new post updates lense
    #feed and author feed
    lense = test_create_lense()
    assert len(lense.feed.entries) == 0
    assert len(lense.author.feed.entries) == 0
    post = Post('test this shit out',
                prefix='/sean/public/%s/posts' % lense.name,
                author=lense.author,
                lense=lense)
    post.save(db=db)
    lense.update()
    assert len(lense.feed.entries) == 1
    assert len(lense.author.feed.entries) == 1
    post.delete()
    lense.update()
    assert len(lense.feed.entries) == 0
    assert len(lense.author.feed.entries) == 0