Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Binh
erp5
Commits
a8e749b6
Commit
a8e749b6
authored
12 years ago
by
Julien Muchembled
Browse files
Options
Download
Email Patches
Plain Diff
Stop using transaction.commit and self.stepTic in unit tests
parent
448e5168
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
19 deletions
+5
-19
bt5/erp5_bearer_token/TestTemplateItem/testERP5BearerToken.py
...erp5_bearer_token/TestTemplateItem/testERP5BearerToken.py
+1
-9
bt5/erp5_bearer_token/bt/revision
bt5/erp5_bearer_token/bt/revision
+1
-1
product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py
...t/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py
+1
-4
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+2
-5
No files found.
bt5/erp5_bearer_token/TestTemplateItem/testERP5BearerToken.py
View file @
a8e749b6
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
transaction
from
DateTime
import
DateTime
class
TestERP5BearerToken
(
ERP5TypeTestCase
):
...
...
@@ -29,7 +28,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
person
=
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
'P'
+
reference
)
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
transaction
.
commit
()
self
.
tic
()
return
person
...
...
@@ -39,7 +37,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
priority
=
1
,
preferred_bearer_token_key
=
self
.
test_id
)
self
.
preference
.
enable
()
transaction
.
commit
()
self
.
tic
()
def
setupBearerExtraction
(
self
):
...
...
@@ -53,7 +50,7 @@ class TestERP5BearerToken(ERP5TypeTestCase):
(
'IExtractionPlugin'
,))
elif
len
(
bearer_extraction_list
)
>
1
:
raise
ValueError
transaction
.
commit
()
self
.
commit
()
def
afterSetUp
(
self
):
"""
...
...
@@ -64,12 +61,10 @@ class TestERP5BearerToken(ERP5TypeTestCase):
self
.
person
=
self
.
createPerson
(
self
.
test_id
)
self
.
setUpBearerTokenKey
()
self
.
setupBearerExtraction
()
transaction
.
commit
()
self
.
tic
()
def
beforeTearDown
(
self
):
self
.
portal
.
portal_preferences
.
deleteContent
(
self
.
preference
.
getId
())
transaction
.
commit
()
self
.
tic
()
def
test_working_token
(
self
):
...
...
@@ -94,16 +89,13 @@ class TestERP5BearerToken(ERP5TypeTestCase):
def
test_no_bearer_token_key
(
self
):
self
.
preference
.
edit
(
preferred_bearer_token_key
=
''
)
transaction
.
commit
()
self
.
tic
()
transaction
.
commit
()
self
.
assertRaises
(
ValueError
,
self
.
person
.
Person_getBearerToken
)
def
test_changed_bearer_token_key
(
self
):
token
,
expiration_time
=
self
.
person
.
Person_getBearerToken
()
self
.
portal
.
REQUEST
.
_auth
=
'Bearer %s'
%
token
self
.
preference
.
edit
(
preferred_bearer_token_key
=
'changed'
)
transaction
.
commit
()
self
.
tic
()
reference
=
self
.
getTokenCredential
(
self
.
portal
.
REQUEST
)
self
.
assertEqual
(
reference
,
None
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_bearer_token/bt/revision
View file @
a8e749b6
10
\ No newline at end of file
11
\ No newline at end of file
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py
View file @
a8e749b6
...
...
@@ -27,8 +27,6 @@
##############################################################################
import
unittest
import
transaction
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
...
...
@@ -345,8 +343,7 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase):
set priority=200
where uid <> %s
"""
%
(
table
,
update_causality_message_uid
))
transaction
.
commit
()
self
.
stepTic
(
sequence
)
self
.
tic
()
@
newSimulationExpectedFailure
@
expectedFailure
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Security/tests/testERP5Security.py
View file @
a8e749b6
...
...
@@ -31,9 +31,6 @@
"""
import
unittest
import
transaction
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -951,7 +948,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
self
.
assertTrue
(
len
(
person_module
.
keys
()))
# When we update security of a module...
person_module
.
reindexObjectSecurity
()
transaction
.
commit
()
self
.
commit
()
# we don't want all underlying objects to be recursively
# reindexed. After all, its contents do not acquire local roles.
check
([
'immediateReindexObject'
])
...
...
@@ -963,7 +960,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
for
rec
in
person_module
.
searchFolder
(
reference
=
self
.
username
)]
self
.
assertTrue
(
len
(
person
.
objectIds
()))
person
.
reindexObjectSecurity
()
transaction
.
commit
()
self
.
commit
()
check
([
'recursiveImmediateReindexObject'
])
self
.
tic
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment