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
38eadfae
Commit
38eadfae
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
[thorstenp] remove some useless space at eol
parent
0830a5fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/lib/data.py
+10
-10
10 additions, 10 deletions
test/lib/data.py
test/lib/mock.py
+21
-21
21 additions, 21 deletions
test/lib/mock.py
test/test_roster.py
+3
-3
3 additions, 3 deletions
test/test_roster.py
with
34 additions
and
34 deletions
test/lib/data.py
+
10
−
10
View file @
38eadfae
...
@@ -6,13 +6,13 @@ account3 = u'dingdong.org'
...
@@ -6,13 +6,13 @@ account3 = u'dingdong.org'
contacts
=
{}
contacts
=
{}
contacts
[
account1
]
=
{
contacts
[
account1
]
=
{
u
'
myjid@
'
+
account1
:
{
u
'
myjid@
'
+
account1
:
{
'
ask
'
:
None
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
ask
'
:
None
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
},
'
subscription
'
:
u
'
both
'
},
u
'
default1@gajim.org
'
:
{
u
'
default1@gajim.org
'
:
{
'
ask
'
:
None
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
ask
'
:
None
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
},
'
subscription
'
:
u
'
both
'
},
u
'
default2@gajim.org
'
:
{
u
'
default2@gajim.org
'
:
{
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupA
'
,],
'
name
'
:
None
,
'
resources
'
:
{},
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupA
'
,],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
},
'
subscription
'
:
u
'
both
'
},
u
'
Cool
"
chârßéµö@gajim.org
'
:
{
u
'
Cool
"
chârßéµö@gajim.org
'
:
{
'
ask
'
:
None
,
'
groups
'
:
[
u
'
<Cool
"
chârßéµö
'
,
u
'
GroupB
'
],
'
ask
'
:
None
,
'
groups
'
:
[
u
'
<Cool
"
chârßéµö
'
,
u
'
GroupB
'
],
...
@@ -23,33 +23,33 @@ contacts[account1] = {
...
@@ -23,33 +23,33 @@ contacts[account1] = {
}
}
contacts
[
account2
]
=
{
contacts
[
account2
]
=
{
u
'
myjid@
'
+
account2
:
{
u
'
myjid@
'
+
account2
:
{
'
ask
'
:
None
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
ask
'
:
None
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
},
'
subscription
'
:
u
'
both
'
},
u
'
default3@gajim.org
'
:
{
u
'
default3@gajim.org
'
:
{
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupC
'
,],
'
name
'
:
None
,
'
resources
'
:
{},
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupC
'
,],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
},
'
subscription
'
:
u
'
both
'
},
u
'
asksubfrom@gajim.org
'
:
{
u
'
asksubfrom@gajim.org
'
:
{
'
ask
'
:
u
'
subscribe
'
,
'
groups
'
:
[
u
'
GroupA
'
,],
'
name
'
:
None
,
'
ask
'
:
u
'
subscribe
'
,
'
groups
'
:
[
u
'
GroupA
'
,],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
from
'
},
'
resources
'
:
{},
'
subscription
'
:
u
'
from
'
},
u
'
subto@gajim.org
'
:
{
u
'
subto@gajim.org
'
:
{
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupB
'
],
'
name
'
:
None
,
'
resources
'
:
{},
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupB
'
],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
to
'
},
'
subscription
'
:
u
'
to
'
},
u
'
samejid@gajim.org
'
:
{
u
'
samejid@gajim.org
'
:
{
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupA
'
,
u
'
GroupB
'
],
'
name
'
:
None
,
'
ask
'
:
None
,
'
groups
'
:
[
u
'
GroupA
'
,
u
'
GroupB
'
],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
}
'
resources
'
:
{},
'
subscription
'
:
u
'
both
'
}
}
}
contacts
[
account3
]
=
{
contacts
[
account3
]
=
{
#u'guypsych0\\40h.com@msn.dingdong.org': {
#u'guypsych0\\40h.com@msn.dingdong.org': {
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
# 'subscription': u'both'},
# 'subscription': u'both'},
u
'
guypsych0%h.com@msn.delx.cjb.net
'
:
{
u
'
guypsych0%h.com@msn.delx.cjb.net
'
:
{
'
ask
'
:
u
'
subscribe
'
,
'
groups
'
:
[],
'
name
'
:
None
,
'
ask
'
:
u
'
subscribe
'
,
'
groups
'
:
[],
'
name
'
:
None
,
'
resources
'
:
{},
'
subscription
'
:
u
'
from
'
},
'
resources
'
:
{},
'
subscription
'
:
u
'
from
'
},
#u'guypsych0%h.com@msn.jabber.wiretrip.org': {
#u'guypsych0%h.com@msn.jabber.wiretrip.org': {
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
# 'subscription': u'to'},
# 'subscription': u'to'},
#u'guypsycho\\40g.com@gtalk.dingdong.org': {
#u'guypsycho\\40g.com@gtalk.dingdong.org': {
# 'ask': None, 'groups': [], 'name': None,
# 'ask': None, 'groups': [], 'name': None,
# 'resources': {}, 'subscription': u'both'}
# 'resources': {}, 'subscription': u'both'}
}
}
# We have contacts that are not in roster but only specified in the metadata
# We have contacts that are not in roster but only specified in the metadata
...
...
This diff is collapsed.
Click to expand it.
test/lib/mock.py
+
21
−
21
View file @
38eadfae
...
@@ -8,26 +8,26 @@
...
@@ -8,26 +8,26 @@
# This Python module and associated files are released under the FreeBSD
# This Python module and associated files are released under the FreeBSD
# license. Essentially, you can do what you like with it except pretend you wrote
# license. Essentially, you can do what you like with it except pretend you wrote
# it yourself.
# it yourself.
#
#
#
#
# Copyright (c) 2005, Dave Kirby
# Copyright (c) 2005, Dave Kirby
#
#
# All rights reserved.
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# modification, are permitted provided that the following conditions are met:
#
#
# * Redistributions of source code must retain the above copyright
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# notice, this list of conditions and the following disclaimer.
#
#
# * Redistributions in binary form must reproduce the above copyright
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# documentation and/or other materials provided with the distribution.
#
#
# * Neither the name of this library nor the names of its
# * Neither the name of this library nor the names of its
# contributors may be used to endorse or promote products derived from
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
# this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# mock@thedeveloperscoach.com
# mock@thedeveloperscoach.com
...
@@ -90,7 +90,7 @@ class Mock:
...
@@ -90,7 +90,7 @@ class Mock:
if
retMethod
not
in
self
.
realClassMethods
:
if
retMethod
not
in
self
.
realClassMethods
:
raise
MockInterfaceError
(
"
Return value supplied for method
'
%s
'
that was not in the original class
"
%
retMethod
)
raise
MockInterfaceError
(
"
Return value supplied for method
'
%s
'
that was not in the original class
"
%
retMethod
)
self
.
_setupSubclassMethodInterceptors
()
self
.
_setupSubclassMethodInterceptors
()
def
_setupSubclassMethodInterceptors
(
self
):
def
_setupSubclassMethodInterceptors
(
self
):
methods
=
inspect
.
getmembers
(
self
.
__class__
,
inspect
.
isroutine
)
methods
=
inspect
.
getmembers
(
self
.
__class__
,
inspect
.
isroutine
)
baseMethods
=
dict
(
inspect
.
getmembers
(
Mock
,
inspect
.
ismethod
))
baseMethods
=
dict
(
inspect
.
getmembers
(
Mock
,
inspect
.
ismethod
))
...
@@ -99,13 +99,13 @@ class Mock:
...
@@ -99,13 +99,13 @@ class Mock:
# Don't record calls to methods of Mock base class.
# Don't record calls to methods of Mock base class.
if
not
name
in
baseMethods
:
if
not
name
in
baseMethods
:
self
.
__dict__
[
name
]
=
MockCallable
(
name
,
self
,
handcrafted
=
True
)
self
.
__dict__
[
name
]
=
MockCallable
(
name
,
self
,
handcrafted
=
True
)
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
return
MockCallable
(
name
,
self
)
return
MockCallable
(
name
,
self
)
def
mockAddReturnValues
(
self
,
**
methodReturnValues
):
def
mockAddReturnValues
(
self
,
**
methodReturnValues
):
self
.
mockReturnValues
.
update
(
methodReturnValues
)
self
.
mockReturnValues
.
update
(
methodReturnValues
)
def
mockSetExpectation
(
self
,
name
,
testFn
,
after
=
0
,
until
=
0
):
def
mockSetExpectation
(
self
,
name
,
testFn
,
after
=
0
,
until
=
0
):
self
.
mockExpectations
.
setdefault
(
name
,
[]).
append
((
testFn
,
after
,
until
))
self
.
mockExpectations
.
setdefault
(
name
,
[]).
append
((
testFn
,
after
,
until
))
...
@@ -134,7 +134,7 @@ class Mock:
...
@@ -134,7 +134,7 @@ class Mock:
numPosCallParams
=
1
+
len
(
callParams
)
numPosCallParams
=
1
+
len
(
callParams
)
if
numPosCallParams
>
len
(
args
)
and
not
varargs
:
if
numPosCallParams
>
len
(
args
)
and
not
varargs
:
raise
MockInterfaceError
(
"
Original %s() takes at most %s arguments (%s given)
"
%
raise
MockInterfaceError
(
"
Original %s() takes at most %s arguments (%s given)
"
%
(
name
,
len
(
args
),
numPosCallParams
))
(
name
,
len
(
args
),
numPosCallParams
))
# Get the number of positional arguments that appear in the call,
# Get the number of positional arguments that appear in the call,
...
@@ -220,7 +220,7 @@ class MockCall:
...
@@ -220,7 +220,7 @@ class MockCall:
def
getName
(
self
):
def
getName
(
self
):
return
self
.
name
return
self
.
name
#pretty-print the method call
#pretty-print the method call
def
__str__
(
self
):
def
__str__
(
self
):
s
=
self
.
name
+
"
(
"
s
=
self
.
name
+
"
(
"
...
@@ -310,13 +310,13 @@ class ReturnValuesBase:
...
@@ -310,13 +310,13 @@ class ReturnValuesBase:
class
ReturnValues
(
ReturnValuesBase
):
class
ReturnValues
(
ReturnValuesBase
):
def
__init__
(
self
,
*
values
):
def
__init__
(
self
,
*
values
):
self
.
iter
=
iter
(
values
)
self
.
iter
=
iter
(
values
)
class
ReturnIterator
(
ReturnValuesBase
):
class
ReturnIterator
(
ReturnValuesBase
):
def
__init__
(
self
,
iterator
):
def
__init__
(
self
,
iterator
):
self
.
iter
=
iter
(
iterator
)
self
.
iter
=
iter
(
iterator
)
def
expectParams
(
*
params
,
**
keywords
):
def
expectParams
(
*
params
,
**
keywords
):
'''
check that the callObj is called with specified params and keywords
'''
check that the callObj is called with specified params and keywords
'''
'''
...
@@ -332,7 +332,7 @@ def expectAfter(*methods):
...
@@ -332,7 +332,7 @@ def expectAfter(*methods):
calledMethods
=
[
method
.
getName
()
for
method
in
mockObj
.
mockGetAllCalls
()]
calledMethods
=
[
method
.
getName
()
for
method
in
mockObj
.
mockGetAllCalls
()]
#skip last entry, since that is the current call
#skip last entry, since that is the current call
calledMethods
=
calledMethods
[:
-
1
]
calledMethods
=
calledMethods
[:
-
1
]
for
method
in
methods
:
for
method
in
methods
:
if
method
not
in
calledMethods
:
if
method
not
in
calledMethods
:
return
False
return
False
return
True
return
True
...
@@ -430,17 +430,17 @@ def IS(instance):
...
@@ -430,17 +430,17 @@ def IS(instance):
def
ISINSTANCE
(
class_
):
def
ISINSTANCE
(
class_
):
def
testFn
(
param
):
def
testFn
(
param
):
return
isinstance
(
param
,
class_
)
return
isinstance
(
param
,
class_
)
return
testFn
return
testFn
def
ISSUBCLASS
(
class_
):
def
ISSUBCLASS
(
class_
):
def
testFn
(
param
):
def
testFn
(
param
):
return
issubclass
(
param
,
class_
)
return
issubclass
(
param
,
class_
)
return
testFn
return
testFn
def
CONTAINS
(
val
):
def
CONTAINS
(
val
):
def
testFn
(
param
):
def
testFn
(
param
):
return
val
in
param
return
val
in
param
return
testFn
return
testFn
def
IN
(
container
):
def
IN
(
container
):
...
...
This diff is collapsed.
Click to expand it.
test/test_roster.py
+
3
−
3
View file @
38eadfae
...
@@ -46,9 +46,9 @@ class TestRosterWindow(unittest.TestCase):
...
@@ -46,9 +46,9 @@ class TestRosterWindow(unittest.TestCase):
contacts
=
gajim
.
contacts
.
get_contacts
(
account
,
jid
)
contacts
=
gajim
.
contacts
.
get_contacts
(
account
,
jid
)
# check for all resources
# check for all resources
for
contact
in
contacts
:
for
contact
in
contacts
:
iters
=
self
.
roster
.
_get_contact_iter
(
jid
,
account
,
iters
=
self
.
roster
.
_get_contact_iter
(
jid
,
account
,
model
=
self
.
roster
.
model
)
model
=
self
.
roster
.
model
)
if
jid
!=
gajim
.
get_jid_from_account
(
account
):
if
jid
!=
gajim
.
get_jid_from_account
(
account
):
# We don't care for groups of SelfContact
# We don't care for groups of SelfContact
self
.
assertTrue
(
len
(
iters
)
==
len
(
contact
.
get_shown_groups
()),
self
.
assertTrue
(
len
(
iters
)
==
len
(
contact
.
get_shown_groups
()),
...
@@ -61,7 +61,7 @@ class TestRosterWindow(unittest.TestCase):
...
@@ -61,7 +61,7 @@ class TestRosterWindow(unittest.TestCase):
if
family
:
if
family
:
nearby_family
,
bb_jid
,
bb_account
=
\
nearby_family
,
bb_jid
,
bb_account
=
\
self
.
roster
.
_get_nearby_family_and_big_brother
(
family
,
account
)
self
.
roster
.
_get_nearby_family_and_big_brother
(
family
,
account
)
is_in_nearby_family
=
(
jid
,
account
)
in
(
is_in_nearby_family
=
(
jid
,
account
)
in
(
(
data
[
'
jid
'
],
data
[
'
account
'
])
for
data
in
nearby_family
)
(
data
[
'
jid
'
],
data
[
'
account
'
])
for
data
in
nearby_family
)
self
.
assertTrue
(
is_in_nearby_family
,
self
.
assertTrue
(
is_in_nearby_family
,
...
...
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