def test_mod(self, req, article): article.title = 'Super title' article.format = FORMAT_RST article.mod(req) second = Article(article.id) second.get(req) assert article.title == second.title assert article.format == second.format
def article(req, request=None, title=u'Title'): article = Article() form = Form((('title', title), ('perex', u'perex'), ('body', u'body'), ('state', 0))) article.bind(form, author_id=1) assert article.add(req) is None return article
def test_list(self, req, article): items = Article.list(req, Pager(), perex=True, state=0) assert len(items) == 1 items = Article.list(req, Pager(), perex=True, state=1) assert len(items) == 0
def test_state(self, req, article): article.set_state(req, 1) second = Article(article.id) second.get(req) assert second.state == 1
def test_get(self, req, article): second = Article(article.id) second.get(req) for attr in ('id', 'title', 'perex', 'body', 'serial_id', 'author_id', 'locale', 'state', 'data'): assert getattr(article, attr) == getattr(second, attr)
def test_db(self, req): Article.test(req)
def test_seo_uri(uri_pair): assert Article.make_uri(uri_pair[0]) == uri_pair[1]