예제 #1
0
    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)
예제 #2
0
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,
    }
예제 #3
0
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,
    }
예제 #4
0
 def test_simple(self):
     a = CommonArticle(name="ahoj a hola")
     self.assertEquals("ahoj-a-hola", a.get_slug())
예제 #5
0
 def test_strip_noncombining(self):
     a = CommonArticle(name="ahoj a 你好")
     self.assertEquals("ahoj-a", a.get_slug())
예제 #6
0
 def test_combining(self):
     a = CommonArticle(name="ahoj a ďíky")
     self.assertEquals("ahoj-a-diky", a.get_slug())
예제 #7
0
 def test_upper(self):
     a = CommonArticle(name="ahoj a HOLA")
     self.assertEquals("ahoj-a-hola", a.get_slug())
예제 #8
0
    def setUp(self):
        super().setUp()
        self.client = Client()

        self.article = CommonArticle(pk=1, name="xoxo")
        self.article.save()
예제 #9
0
 def test_simple(self):
     a = CommonArticle(jmeno='ahoj a hola')
     self.assertEquals('ahoj-a-hola', a.get_slug())
예제 #10
0
 def test_strip_noncombining(self):
     a = CommonArticle(jmeno='ahoj a 你好')
     self.assertEquals('ahoj-a', a.get_slug())
예제 #11
0
 def test_combining(self):
     a = CommonArticle(jmeno='ahoj a ďíky')
     self.assertEquals('ahoj-a-diky', a.get_slug())
예제 #12
0
 def test_upper(self):
     a = CommonArticle(jmeno='ahoj a HOLA')
     self.assertEquals('ahoj-a-hola', a.get_slug())
예제 #13
0
    def setUp(self):
        super().setUp()
        self.client = Client()

        self.article = CommonArticle(pk=1, jmeno='xoxo')
        self.article.save()