9578053 Jan 22 2022 distfiles.gentoo.org/distfiles/gajim-1.3.3-2.tar.gz
This commit is contained in:
parent
a5b3822651
commit
4c1b226bff
1045 changed files with 753037 additions and 18 deletions
0
test/no_gui/__init__.py
Normal file
0
test/no_gui/__init__.py
Normal file
36
test/no_gui/test_regex.py
Normal file
36
test/no_gui/test_regex.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
import unittest
|
||||
|
||||
from gajim import gui
|
||||
gui.init('gtk')
|
||||
import gajim.common.regex as regex
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
def test_links_regexp_entire(self):
|
||||
def assert_matches_all(str_):
|
||||
m = regex.BASIC_REGEX.match(str_)
|
||||
|
||||
# the match should equal the string
|
||||
str_span = (0, len(str_))
|
||||
self.assertEqual(m.span(), str_span)
|
||||
|
||||
# these entire strings should be parsed as links
|
||||
assert_matches_all('http://google.com/')
|
||||
assert_matches_all('http://google.com')
|
||||
assert_matches_all('http://www.google.ca/search?q=xmpp')
|
||||
|
||||
assert_matches_all('http://tools.ietf.org/html/draft-saintandre-rfc3920bis-05#section-12.3')
|
||||
|
||||
assert_matches_all('http://en.wikipedia.org/wiki/Protocol_(computing)')
|
||||
assert_matches_all(
|
||||
'http://en.wikipedia.org/wiki/Protocol_%28computing%29')
|
||||
|
||||
assert_matches_all('mailto:test@example.org')
|
||||
|
||||
assert_matches_all('xmpp:example-node@example.com')
|
||||
assert_matches_all('xmpp:example-node@example.com/some-resource')
|
||||
assert_matches_all('xmpp:example-node@example.com?message')
|
||||
assert_matches_all('xmpp://guest@example.com/support@example.com?message')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
5
test/no_gui/unit/__init__.py
Normal file
5
test/no_gui/unit/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
'''
|
||||
|
||||
This package just contains plain unit tests
|
||||
|
||||
'''
|
50
test/no_gui/unit/test_nick_completion.py
Normal file
50
test/no_gui/unit/test_nick_completion.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
import unittest
|
||||
|
||||
from gajim import gui
|
||||
gui.init('gtk')
|
||||
from gajim.gui.util import NickCompletionGenerator
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_generate_suggestions(self):
|
||||
gen = NickCompletionGenerator('meeeee')
|
||||
|
||||
l = ['aaaa', 'meeeee', 'fooo', 'xxxxz', 'xaaaz']
|
||||
for n in l:
|
||||
gen.record_message(n, False)
|
||||
l2 = ['xxx'] + l
|
||||
r = gen.generate_suggestions(nicks=l2, beginning='x')
|
||||
self.assertEqual(r, ['xaaaz', 'xxxxz', 'xxx'])
|
||||
|
||||
r = gen.generate_suggestions(
|
||||
nicks=l2,
|
||||
beginning='m'
|
||||
)
|
||||
self.assertEqual(r, [])
|
||||
|
||||
for n in ['xaaaz', 'xxxxz']:
|
||||
gen.record_message(n, True)
|
||||
|
||||
r = gen.generate_suggestions(
|
||||
nicks=l2,
|
||||
beginning='x'
|
||||
)
|
||||
self.assertEqual(r, ['xxxxz', 'xaaaz', 'xxx'])
|
||||
r = gen.generate_suggestions(
|
||||
nicks=l2,
|
||||
beginning=''
|
||||
)
|
||||
self.assertEqual(r, ['xxxxz', 'xaaaz', 'aaaa', 'fooo', 'xxx'])
|
||||
|
||||
l2[1] = 'bbbb'
|
||||
gen.contact_renamed('aaaa', 'bbbb')
|
||||
r = gen.generate_suggestions(
|
||||
nicks=l2,
|
||||
beginning=''
|
||||
)
|
||||
self.assertEqual(r, ['xxxxz', 'xaaaz', 'bbbb', 'fooo', 'xxx'])
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue