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
eta
gajim
Commits
8946af33
Commit
8946af33
authored
6 years ago
by
André
Committed by
Philipp Hörist
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Test: caps cache: use mock from unittest
parent
e8941a4f
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/unit/test_caps_cache.py
+7
-6
7 additions, 6 deletions
test/unit/test_caps_cache.py
with
7 additions
and
6 deletions
test/unit/test_caps_cache.py
+
7
−
6
View file @
8946af33
...
...
@@ -6,13 +6,11 @@ import unittest
import
lib
lib
.
setup_env
()
from
unittest.mock
import
MagicMock
from
unittest.mock
import
MagicMock
,
Mock
from
nbxmpp
import
NS_MUC
,
NS_PING
,
NS_XHTML_IM
,
Iq
from
gajim.common
import
caps_cache
as
caps
from
gajim.common.modules.discovery
import
Discovery
from
mock
import
Mock
COMPLEX_EXAMPLE
=
'''
<iq from=
'
benvolio@capulet.lit/230193
'
id=
'
disco1
'
to=
'
juliet@capulet.lit/chamber
'
type=
'
result
'
>
<query xmlns=
'
http://jabber.org/protocol/disco#info
'
node=
'
http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=
'
>
...
...
@@ -64,7 +62,8 @@ class CommonCapsTest(unittest.TestCase):
db_caps_cache
=
[
(
self
.
caps_method
,
self
.
caps_hash
,
self
.
identities
,
self
.
features
),
(
'
old
'
,
self
.
node
+
'
#
'
+
self
.
caps_hash
,
self
.
identities
,
self
.
features
)]
self
.
logger
=
Mock
(
returnValues
=
{
"
iter_caps_data
"
:
db_caps_cache
})
self
.
logger
=
Mock
()
self
.
logger
.
iter_caps_data
=
Mock
(
return_value
=
db_caps_cache
)
self
.
cc
=
caps
.
CapsCache
(
self
.
logger
)
caps
.
capscache
=
self
.
cc
...
...
@@ -95,8 +94,10 @@ class TestCapsCache(CommonCapsTest):
item
=
self
.
cc
[
self
.
client_caps
]
item
.
set_and_store
(
self
.
identities
,
self
.
features
)
self
.
logger
.
mockCheckCall
(
0
,
"
add_caps_entry
"
,
self
.
caps_method
,
self
.
caps_hash
,
self
.
identities
,
self
.
features
)
self
.
logger
.
add_caps_entry
.
assert_called_once_with
(
self
.
caps_method
,
self
.
caps_hash
,
self
.
identities
,
self
.
features
)
def
test_initialize_from_db
(
self
):
'''
Read cashed dummy data from db
'''
...
...
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