Example #1
0
def test_delete_feed():
    f = Feed(url=prefix, author=author, db=db)
    p = Post("test this out", prefix=prefix, author=author, db=db).save()
    f.add_post(p)
    f.delete()
    assert_raises(Exception, db.get, f.url)
    assert_raises(Exception, db.get, p.url)
Example #2
0
def test_delete_post():
    f = Feed(title="facebook", url=prefix, author=author, db=db)
    p = Post("test this out", prefix=prefix, author=author)
    f.add_post(p)
    assert len(f.entries) == 1
    f.remove_post(p.url)
    assert len(f.entries) == 0
    assert_raises(Exception, f.remove_post, p.url)
Example #3
0
def test_delete_lense():
    lense = test_create_lense()
    a = lense.author
    f = lense.feed
    assert Feed().load(f.url, db) == f
    lense.delete()
    assert_raises(Exception, db.get, f.url)
    assert_raises(Exception, db.get, lense.url)
Example #4
0
def test_load_from_db():
    '''
    Make sure we can save and rehydrate
    a feed instance from the database.
    '''
    f = create_feed()
    f.save(db=db)
    created = Feed(db=db).load(f.url)
Example #5
0
def test_delete_feed():
    f = Feed(url=prefix, author=author, db=db)
    p = Post('test this out', prefix=prefix, author=author, db=db).save()
    f.add_post(p)
    f.delete()
    assert_raises(Exception, db.get, f.url)
    assert_raises(Exception, db.get, p.url)
Example #6
0
def test_links():
    '''
    test that the links generated are correct.
                 links=[{'href' : 'http://www.google.com',
                       'rel' : 'self'},
                       {'href' : 'http://www.yahoo.com'}],

    '''
    f = Feed(title='facebook', url=prefix, author=author, db=db)
    assert len(f.links) == 2
    assert f.links[0]['rel'] == 'self'
    assert f.links[0]['href'] == 'http://www.%s%s' % (config.domain, f.url)
    assert f.links[1]['href'] == 'http://www.%s' % config.domain
Example #7
0
def test_delete_post():
    f = Feed(title='facebook', url=prefix, author=author, db=db)
    p = Post('test this out', prefix=prefix, author=author)
    f.add_post(p)
    assert len(f.entries) == 1
    f.remove_post(p.url)
    assert len(f.entries) == 0
    assert_raises(Exception, f.remove_post, p.url)
Example #8
0
def create_feed(now=None):
    author = Author(subdomain='potter',
                     email='*****@*****.**')\
                     .save(db=db)
    if not now:
        now = dt.now()
    return Feed(title='pics',
                links=[{
                    'href': 'http://www.google.com',
                    'rel': 'self'
                }, {
                    'href': 'http://www.yahoo.com'
                }],
                updated=now,
                author=author,
                url='/potter/private/pics/posts',
                db=db)
Example #9
0
def test_lense_feed():
    lense = test_create_lense()
    feed = lense.feed
    f = Feed().load(feed.url, db=db)
    assert f == feed
    assert f.url == lense.url + "/posts"
Example #10
0
def test_add_post():
    f = Feed(url=prefix, author=author, db=db)
    assert len(f.entries) == 0
    f.add_post(Post('test this out', prefix=prefix, author=author))
    assert len(f.entries) == 1
Example #11
0
def test_add_post():
    f = Feed(url=prefix, author=author, db=db)
    assert len(f.entries) == 0
    f.add_post(Post("test this out", prefix=prefix, author=author))
    assert len(f.entries) == 1