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)
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)
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)
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)
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)
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
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)
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)
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"
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
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