5 import com
.meterware
.httpunit
as http
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
)
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")
44 s
= KeywordProcessor
.createKeywords(str)
45 self
.assertEquals(s
, "")
49 # Change the following two class references
50 suite
= junit
.framework
.TestSuite()
51 for i
in dir(testKeywords
):
52 if i
.startswith("test"):