Exemple #1
0
 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
Exemple #2
0
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
Exemple #3
0
 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
Exemple #4
0
 def test_state(self, req, article):
     article.set_state(req, 1)
     second = Article(article.id)
     second.get(req)
     assert second.state == 1
Exemple #5
0
 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)
Exemple #6
0
 def test_db(self, req):
     Article.test(req)
Exemple #7
0
def test_seo_uri(uri_pair):
    assert Article.make_uri(uri_pair[0]) == uri_pair[1]