Exemple #1
0
    def test_AliasList_blank(self):
        alias_create(self.mockRequest(POST={"oldtag": u"Bender", "newtag": u"Bender_Bending_Rodriguez"}))
        alias_create(self.mockRequest(POST={"oldtag": u"Obama", "newtag": u"Barack_Obama"}))

        info = alias_list(self.mockRequest())
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertIn(u"Bender", aliases)
Exemple #2
0
    def test_AliasList_noResult(self):
        alias_create(self.mockRequest(POST={"oldtag": u"Bender", "newtag": u"Bender_Bending_Rodriguez"}))
        alias_create(self.mockRequest(POST={"oldtag": u"Obama", "newtag": u"Barack_Obama"}))

        info = alias_list(self.mockRequest(GET={"newtag": u"cats"}))
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertListEqual([], aliases)
Exemple #3
0
    def test_AliasDelete(self):
        alias_create(self.mockRequest(POST={"oldtag": u"Bender", "newtag": u"Bender_Bending_Rodriguez"}))

        info = alias_delete(self.mockRequest(matchdict={"id": u"Bender"}))
        self.assertIsInstance(info, HTTPFound)

        info = alias_list(self.mockRequest())
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertListEqual([], aliases)
Exemple #4
0
    def test_Create_loop(self):
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Bender",
                "newtag": u"Bender_Bending_Rodriguez"
            }))

        request = self.mockRequest(POST={
            "oldtag": u"bender_bending_rodriguez",
            "newtag": u"bender"
        })
        self.assertRaises(AliasLoopException, alias_create, request)
Exemple #5
0
    def test_AliasDelete(self):
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Bender",
                "newtag": u"Bender_Bending_Rodriguez"
            }))

        info = alias_delete(self.mockRequest(matchdict={"id": u"Bender"}))
        self.assertIsInstance(info, HTTPFound)

        info = alias_list(self.mockRequest())
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertListEqual([], aliases)
Exemple #6
0
    def test_AliasList_noResult(self):
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Bender",
                "newtag": u"Bender_Bending_Rodriguez"
            }))
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Obama",
                "newtag": u"Barack_Obama"
            }))

        info = alias_list(self.mockRequest(GET={"newtag": u"cats"}))
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertListEqual([], aliases)
Exemple #7
0
    def test_AliasList_blank(self):
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Bender",
                "newtag": u"Bender_Bending_Rodriguez"
            }))
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Obama",
                "newtag": u"Barack_Obama"
            }))

        info = alias_list(self.mockRequest())
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertIn(u"Bender", aliases)
Exemple #8
0
    def test_Create_ok(self):
        info = alias_create(self.mockRequest(POST={"oldtag": u"Bender", "newtag": u"Bender_Bending_Rodriguez"}))
        self.assertIsInstance(info, HTTPFound)

        info = alias_list(self.mockRequest())
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertIn(u"Bender", aliases)
Exemple #9
0
    def test_AliasListCSV_blank(self):
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Bender",
                "newtag": u"Bender_Bending_Rodriguez"
            }))
        alias_create(
            self.mockRequest(POST={
                "oldtag": u"Obama",
                "newtag": u"Barack_Obama"
            }))

        info = alias_list_csv(self.mockRequest())
        self.assertListEqual(info["data"],
                             [("Obama", "Barack_Obama"),
                              ("Bender", "Bender_Bending_Rodriguez")])
Exemple #10
0
    def test_Create_ok(self):
        info = alias_create(
            self.mockRequest(POST={
                "oldtag": u"Bender",
                "newtag": u"Bender_Bending_Rodriguez"
            }))
        self.assertIsInstance(info, HTTPFound)

        info = alias_list(self.mockRequest())
        aliases = [alias.oldtag for alias in info["aliases"]]
        self.assertIn(u"Bender", aliases)
Exemple #11
0
    def test_AliasListCSV_blank(self):
        alias_create(self.mockRequest(POST={"oldtag": u"Bender", "newtag": u"Bender_Bending_Rodriguez"}))
        alias_create(self.mockRequest(POST={"oldtag": u"Obama", "newtag": u"Barack_Obama"}))

        info = alias_list_csv(self.mockRequest())
        self.assertListEqual(info["data"], [("Obama", "Barack_Obama"), ("Bender", "Bender_Bending_Rodriguez")])
Exemple #12
0
    def test_Create_loop(self):
        alias_create(self.mockRequest(POST={"oldtag": u"Bender", "newtag": u"Bender_Bending_Rodriguez"}))

        request = self.mockRequest(POST={"oldtag": u"bender_bending_rodriguez", "newtag": u"bender"})
        self.assertRaises(AliasLoopException, alias_create, request)