Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
59f9d7dc
Commit
59f9d7dc
authored
16 years ago
by
Brendan Taylor
Browse files
Options
Downloads
Patches
Plain Diff
test for URL regexp
parent
b4909044
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_misc_interface.py
+47
-0
47 additions, 0 deletions
test/test_misc_interface.py
test/testlib.py
+3
-0
3 additions, 0 deletions
test/testlib.py
with
50 additions
and
0 deletions
test/test_misc_interface.py
0 → 100644
+
47
−
0
View file @
59f9d7dc
# tests for the miscellaneous functions scattered throughout src/gajim.py
import
unittest
import
testlib
testlib
.
setup_env
()
from
common
import
gajim
from
common
import
xmpp
from
common.caps
import
CapsCache
from
mock
import
Mock
from
gajim
import
Interface
gajim
.
logger
=
Mock
()
Interface
()
class
TestMiscInterface
(
unittest
.
TestCase
):
def
test_links_regexp_entire
(
self
):
def
assert_matches_all
(
str
):
m
=
gajim
.
interface
.
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
()
This diff is collapsed.
Click to expand it.
test/testlib.py
+
3
−
0
View file @
59f9d7dc
...
...
@@ -30,3 +30,6 @@ def setup_env():
from
common
import
gajim
gajim
.
DATA_DIR
=
gajim_root
+
'
/data
'
import
gtkgui_helpers
gtkgui_helpers
.
GLADE_DIR
=
gajim_root
+
'
/data/glade
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment