def test_redirect_for_empty_slug(self): article = CommonArticle(pk=2, jmeno=" ") article.save() res = self.client.get("/rubriky/clanky/2-random-slug/", follow=True) self.assertEquals([("/rubriky/clanky/2-dilo/", 301)], res.redirect_chain) self.assertEquals(200, res.status_code)
def get_valid_article_chain(): user = UserProfile(nick="Author", email="*****@*****.**") author = Author(id=1, user=user, author_type=Author.USER_TYPE) article = CommonArticle( author=author, name="Test Article", author_nick=user.nick, author_mail=user.email, is_published=CommonArticle.CREATION_APPROVED, creative_page_slug="clanky", ) return { "user": user, "author": author, "article": article, }
def get_valid_article_chain(): user = UserProfile(nick_uzivatele="Author", email_uzivatele="*****@*****.**") author = Author(id=1, user=user, author_type=Author.USER_TYPE) article = CommonArticle( author=author, jmeno="Test Article", autor=user.nick_uzivatele, autmail=user.email_uzivatele, schvaleno=CommonArticle.CREATION_APPROVED, rubrika="clanky", ) return { "user": user, "author": author, "article": article, }
def test_simple(self): a = CommonArticle(name="ahoj a hola") self.assertEquals("ahoj-a-hola", a.get_slug())
def test_strip_noncombining(self): a = CommonArticle(name="ahoj a 你好") self.assertEquals("ahoj-a", a.get_slug())
def test_combining(self): a = CommonArticle(name="ahoj a ďíky") self.assertEquals("ahoj-a-diky", a.get_slug())
def test_upper(self): a = CommonArticle(name="ahoj a HOLA") self.assertEquals("ahoj-a-hola", a.get_slug())
def setUp(self): super().setUp() self.client = Client() self.article = CommonArticle(pk=1, name="xoxo") self.article.save()
def test_simple(self): a = CommonArticle(jmeno='ahoj a hola') self.assertEquals('ahoj-a-hola', a.get_slug())
def test_strip_noncombining(self): a = CommonArticle(jmeno='ahoj a 你好') self.assertEquals('ahoj-a', a.get_slug())
def test_combining(self): a = CommonArticle(jmeno='ahoj a ďíky') self.assertEquals('ahoj-a-diky', a.get_slug())
def test_upper(self): a = CommonArticle(jmeno='ahoj a HOLA') self.assertEquals('ahoj-a-hola', a.get_slug())
def setUp(self): super().setUp() self.client = Client() self.article = CommonArticle(pk=1, jmeno='xoxo') self.article.save()