@@ -49,7 +49,7 @@ def getclass(self, name):
4949 raise KeyError ('There is no class called "%s"' % name )
5050 # Class returned must have hasnode(id) method that returns true
5151 # otherwise designators like 'issue1' can't be hyperlinked.
52- self .classes [name ].hasnode = lambda id : True
52+ self .classes [name ].hasnode = lambda id : True if int ( id ) < 10 else False
5353 return self .classes [name ]
5454
5555 # setup for csrf testing of otks database api
@@ -252,6 +252,26 @@ def test_string_plain_or_hyperlinked(self):
252252 self .
assertEqual (
p .
plain (
escape = 1 ,
hyperlink = 1 ),
'A string <b> with <a href="mailto:[email protected] ">[email protected] </a> embedded &lt; html</b>' )
253253
254254 self .
assertEqual (
p .
hyperlinked (),
'A string <b> with <a href="mailto:[email protected] ">[email protected] </a> embedded &lt; html</b>' )
255+ # check designators
256+ for designator in [ "issue1" , "issue 1" ]:
257+ p = StringHTMLProperty (self .client , 'test' , '1' , None , 'test' , designator )
258+ self .assertEqual (p .hyperlinked (),
259+ '<a href="issue1">%s</a>' % designator )
260+
261+ # issue 100 > 10 which is a magic number for the mocked hasnode
262+ # If id number is greater than 10 hasnode reports it does not have
263+ # the node.
264+ for designator in ['issue100' , 'issue 100' ]:
265+ p = StringHTMLProperty (self .client , 'test' , '1' , None , 'test' ,
266+ designator )
267+ self .assertEqual (p .hyperlinked (), designator )
268+
269+ # zoom class does not exist
270+ for designator in ['zoom1' , 'zoom100' , 'zoom 1' ]:
271+ p = StringHTMLProperty (self .client , 'test' , '1' , None , 'test' ,
272+ designator )
273+ self .assertEqual (p .hyperlinked (), designator )
274+
255275
256276 @skip_rst
257277 def test_string_rst (self ):
0 commit comments