def test_update_author(): a = Author(db=db, email='test', subdomain='test') a.save() assert Author().load(a.url, db=db).email == 'test' a.email = 'changed' a.save() assert Author().load(a.url, db=db).email == 'changed'
def test_get_lenses(): a = Author(email='*****@*****.**', subdomain='sean') a.save(db=db) assert len(a.lenses) == 0 l = Lense(name='facebook', subdomain=SUBDOMAIN, db=db, author=a).save() a.update() assert len(a.lenses) == 1 l.delete() a.update() assert len(a.lenses) == 0, "failed to delete lense"
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_add_author(): a = Author(email='*****@*****.**', subdomain='sean') a.save(db=db) b = Author().load(a.url, db=db) assert a == b, "Author wasn't saved correctly" a = Author(db=db) assert_raises(Exception, a.save) a = Author(db=db, email='test') assert_raises(Exception, a.save) a = Author(db=db, subdomain='test') assert_raises(Exception, a.save) a = Author(db=db, email='test', subdomain='invalid subdomain') assert_raises(Exception, a.save)
def test_author_url(): a = Author(email='test', subdomain='test') assert a.url == '/test'