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)
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)
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)
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)
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)
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)
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)
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)
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")])
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)
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")])
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)