示例#1
0
 def test_legit_refs(self, lookup):
     shortlink = mock.Mock(url='/p/project/tool/artifact')
     shortlink.ref.artifact.deleted = False
     lookup.return_value = shortlink
     self.assertEqual(mde.TracRef1().sub('#100'),
                      '[#100](/p/project/tool/artifact)')
     self.assertEqual(mde.TracRef1().sub('r123'),
                      '[r123](/p/project/tool/artifact)')
示例#2
0
 def test_run(self, lookup):
     shortlink = mock.Mock(url='/p/project/tool/artifact')
     shortlink.ref.artifact.deleted = False
     lookup.return_value = shortlink
     p = mde.PatternReplacingProcessor(mde.TracRef1(), mde.TracRef2())
     res = p.run(['#100', 'ticket:100'])
     self.assertEqual(res, [
         '[#100](/p/project/tool/artifact)',
         '[ticket:100](/p/project/tool/artifact)'])
示例#3
0
 def test_word_boundaries(self):
     self.assertEqual(mde.TracRef1().sub('foo#100'), 'foo#100')
     self.assertEqual(mde.TracRef1().sub('r123bar'), 'r123bar')
示例#4
0
 def test_skip_if_brackets(self):
     self.assertEqual(mde.TracRef1().sub('[#100]'), '[#100]')
     self.assertEqual(mde.TracRef1().sub('[r123]'), '[r123]')
示例#5
0
 def test_no_such_artifact(self, lookup):
     lookup.return_value = None
     self.assertEqual(mde.TracRef1().sub('#100'), '#100')