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
b5753fec
Commit
b5753fec
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
test hash computation in caps test
parent
8f89d244
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_caps.py
+23
-11
23 additions, 11 deletions
test/test_caps.py
with
23 additions
and
11 deletions
test/test_caps.py
+
23
−
11
View file @
b5753fec
...
...
@@ -6,6 +6,7 @@ lib.setup_env()
from
common
import
gajim
from
common
import
xmpp
from
common
import
helpers
from
common.caps
import
CapsCache
...
...
@@ -20,22 +21,27 @@ class TestCapsCache(unittest.TestCase):
self
.
logger
=
MockLogger
()
self
.
cc
=
CapsCache
(
self
.
logger
)
def
test_examples
(
self
):
'''
tests the examples given in common/caps.py
'''
self
.
caps_method
=
'
sha-1
'
self
.
caps_hash
=
'
zaQfb22o0UCwYDIk8KZOnoZTnrs=
'
self
.
caps
=
(
self
.
caps_method
,
self
.
caps_hash
)
self
.
identity
=
{
'
category
'
:
'
client
'
,
'
type
'
:
'
pc
'
}
caps
=
(
'
sha-1
'
,
'
66/0NaeaBKkwk85efJTGmU47vXI=
'
)
identity
=
{
'
category
'
:
'
client
'
,
'
type
'
:
'
pc
'
}
self
.
muc
=
'
http://jabber.org/protocol/muc
'
self
.
chatstates
=
'
http://jabber.org/protocol/chatstates
'
muc
=
'
http://jabber.org/protocol/muc
'
chatstates
=
'
http://jabber.org/protocol/chatstates
'
self
.
identities
=
[
self
.
identity
]
self
.
features
=
[
self
.
muc
]
self
.
cc
[
caps
].
identities
=
[
identity
]
self
.
cc
[
caps
].
features
=
[
muc
]
def
test_examples
(
self
):
'''
tests the examples given in common/caps.py
'''
self
.
assert_
(
muc
in
self
.
cc
[
caps
].
featur
es
)
self
.
assert_
(
chatstates
not
in
self
.
cc
[
caps
]
.
features
)
self
.
cc
[
self
.
caps
].
identities
=
self
.
identiti
es
self
.
cc
[
self
.
caps
].
features
=
self
.
features
id
=
self
.
cc
[
caps
].
identities
self
.
assert_
(
self
.
muc
in
self
.
cc
[
self
.
caps
].
features
)
self
.
assert_
(
self
.
chatstates
not
in
self
.
cc
[
self
.
caps
].
features
)
id
=
self
.
cc
[
self
.
caps
].
identities
self
.
assertEqual
(
1
,
len
(
id
))
...
...
@@ -43,6 +49,12 @@ class TestCapsCache(unittest.TestCase):
self
.
assertEqual
(
'
client
'
,
id
[
'
category
'
])
self
.
assertEqual
(
'
pc
'
,
id
[
'
type
'
])
def
test_hash
(
self
):
'''
tests the hash computation
'''
computed_hash
=
helpers
.
compute_caps_hash
(
self
.
identities
,
self
.
features
)
self
.
assertEqual
(
self
.
caps_hash
,
computed_hash
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
...
...
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