adding all of botlist, initial add
[botlist.git] / openbotlist / tests / misc / py / test_keywords.py
blob2a20ee6dee79e362b013c3658a2f4358c9e319c1
1 ##
2 ## Berlin Brown
3 ##
5 import com.meterware.httpunit as http
7 import all_tests
8 import config as cfg
9 import junit
11 from org.spirit.util.xml import EscapeHTML
12 from org.spirit.util.text import KeywordProcessor
14 class testKeywords (junit.framework.TestCase):
15 def __init__(self, name):
16 junit.framework.TestCase.__init__(self, name)
17 self.theTestFunction = getattr(self, name)
19 def setUp(self):
20 pass
22 def tearDown(self):
23 pass
25 def runTest(self):
26 self.theTestFunction()
28 def testCreateFilenameTitle(self):
29 str = "This is the title I want to create 2233 999--3823**2323kj err"
30 s = KeywordProcessor.createFilenameTitle(str)
31 self.assertEquals(s, "this_is_the_title_i_want_to_create_2233_99938232323kj_err")
33 def testTagViewKeywords(self):
34 str = "g@@##%@#!@@$!@$ I am \n\ttesting it @(#()!@#(*)"
35 s = KeywordProcessor.tagViewKeywords(str, "style", "/spring/botverse_tags?defkeytagid=", "")
36 self.assertEquals(s, '<a style="style" href="/spring/botverse_tags?defkeytagid=g">g</a>\n<a style="style" href="/spring/botverse_tags?defkeytagid=i">i</a>\n<a style="style" href="/spring/botverse_tags?defkeytagid=am">am</a>\n<a style="style" href="/spring/botverse_tags?defkeytagid=testing">testing</a>\n<a style="style" href="/spring/botverse_tags?defkeytagid=it">it</a>\n')
38 def testCreateKeyword(self):
39 str = "This is my tag@@##%@#!@@$!@$ I am testing it @(#()!@#(*)"
40 s = KeywordProcessor.createKeywords(str)
41 self.assertEquals(s, "this is my tag i am testing it")
43 str = ""
44 s = KeywordProcessor.createKeywords(str)
45 self.assertEquals(s, "")
47 def suite():
49 # Change the following two class references
50 suite = junit.framework.TestSuite()
51 for i in dir(testKeywords):
52 if i.startswith("test"):
53 p = testKeywords(i)
54 suite.addTest(p)
56 return suite
58 # End of Script