Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndré Apitzsch <git@apitzsch.eu>2021-02-13 19:51:50 +0300
committerAndré Apitzsch <git@apitzsch.eu>2021-02-13 20:09:41 +0300
commitb243c3c0efdccfaf1d3a5f8df558080b4702286a (patch)
treeaee5e96b83b4b677c31106875148a5b7182a7fd4 /test
parent1ac4fd7a2ecb269d986060149e501e2954d25925 (diff)
Move regex tests
Diffstat (limited to 'test')
-rw-r--r--test/no_gui/test_regex.py36
-rw-r--r--test/unit/test_gui_interface.py27
2 files changed, 36 insertions, 27 deletions
diff --git a/test/no_gui/test_regex.py b/test/no_gui/test_regex.py
new file mode 100644
index 000000000..cab31831e
--- /dev/null
+++ b/test/no_gui/test_regex.py
@@ -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()
diff --git a/test/unit/test_gui_interface.py b/test/unit/test_gui_interface.py
index 2e4ac5c74..41274dfd4 100644
--- a/test/unit/test_gui_interface.py
+++ b/test/unit/test_gui_interface.py
@@ -24,33 +24,6 @@ class TestInterface(unittest.TestCase):
GLib.idle_add(close_app)
app.app.run()
- def test_links_regexp_entire(self):
- sut = Interface()
- def assert_matches_all(str_):
- m = sut.basic_pattern_re.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()