Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
a8e749b6
Commit
a8e749b6
authored
Jan 11, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
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.
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
transaction
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestERP5BearerToken
(
ERP5TypeTestCase
):
class
TestERP5BearerToken
(
ERP5TypeTestCase
):
...
@@ -29,7 +28,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
...
@@ -29,7 +28,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
person
=
person_module
.
newContent
(
portal_type
=
'Person'
,
person
=
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
'P'
+
reference
)
reference
=
'P'
+
reference
)
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
return
person
return
person
...
@@ -39,7 +37,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
...
@@ -39,7 +37,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
priority
=
1
,
priority
=
1
,
preferred_bearer_token_key
=
self
.
test_id
)
preferred_bearer_token_key
=
self
.
test_id
)
self
.
preference
.
enable
()
self
.
preference
.
enable
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
def
setupBearerExtraction
(
self
):
def
setupBearerExtraction
(
self
):
...
@@ -53,7 +50,7 @@ class TestERP5BearerToken(ERP5TypeTestCase):
...
@@ -53,7 +50,7 @@ class TestERP5BearerToken(ERP5TypeTestCase):
(
'IExtractionPlugin'
,))
(
'IExtractionPlugin'
,))
elif
len
(
bearer_extraction_list
)
>
1
:
elif
len
(
bearer_extraction_list
)
>
1
:
raise
ValueError
raise
ValueError
transaction
.
commit
()
self
.
commit
()
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
"""
"""
...
@@ -64,12 +61,10 @@ class TestERP5BearerToken(ERP5TypeTestCase):
...
@@ -64,12 +61,10 @@ class TestERP5BearerToken(ERP5TypeTestCase):
self
.
person
=
self
.
createPerson
(
self
.
test_id
)
self
.
person
=
self
.
createPerson
(
self
.
test_id
)
self
.
setUpBearerTokenKey
()
self
.
setUpBearerTokenKey
()
self
.
setupBearerExtraction
()
self
.
setupBearerExtraction
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
self
.
portal
.
portal_preferences
.
deleteContent
(
self
.
preference
.
getId
())
self
.
portal
.
portal_preferences
.
deleteContent
(
self
.
preference
.
getId
())
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
def
test_working_token
(
self
):
def
test_working_token
(
self
):
...
@@ -94,16 +89,13 @@ class TestERP5BearerToken(ERP5TypeTestCase):
...
@@ -94,16 +89,13 @@ class TestERP5BearerToken(ERP5TypeTestCase):
def
test_no_bearer_token_key
(
self
):
def
test_no_bearer_token_key
(
self
):
self
.
preference
.
edit
(
preferred_bearer_token_key
=
''
)
self
.
preference
.
edit
(
preferred_bearer_token_key
=
''
)
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
transaction
.
commit
()
self
.
assertRaises
(
ValueError
,
self
.
person
.
Person_getBearerToken
)
self
.
assertRaises
(
ValueError
,
self
.
person
.
Person_getBearerToken
)
def
test_changed_bearer_token_key
(
self
):
def
test_changed_bearer_token_key
(
self
):
token
,
expiration_time
=
self
.
person
.
Person_getBearerToken
()
token
,
expiration_time
=
self
.
person
.
Person_getBearerToken
()
self
.
portal
.
REQUEST
.
_auth
=
'Bearer %s'
%
token
self
.
portal
.
REQUEST
.
_auth
=
'Bearer %s'
%
token
self
.
preference
.
edit
(
preferred_bearer_token_key
=
'changed'
)
self
.
preference
.
edit
(
preferred_bearer_token_key
=
'changed'
)
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
reference
=
self
.
getTokenCredential
(
self
.
portal
.
REQUEST
)
reference
=
self
.
getTokenCredential
(
self
.
portal
.
REQUEST
)
self
.
assertEqual
(
reference
,
None
)
self
.
assertEqual
(
reference
,
None
)
...
...
bt5/erp5_bearer_token/bt/revision
View file @
a8e749b6
10
11
\ No newline at end of file
\ No newline at end of file
product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py
View file @
a8e749b6
...
@@ -27,8 +27,6 @@
...
@@ -27,8 +27,6 @@
##############################################################################
##############################################################################
import
unittest
import
unittest
import
transaction
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.Sequence
import
SequenceList
...
@@ -345,8 +343,7 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase):
...
@@ -345,8 +343,7 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase):
set priority=200
set priority=200
where uid <> %s
where uid <> %s
"""
%
(
table
,
update_causality_message_uid
))
"""
%
(
table
,
update_causality_message_uid
))
transaction
.
commit
()
self
.
tic
()
self
.
stepTic
(
sequence
)
@
newSimulationExpectedFailure
@
newSimulationExpectedFailure
@
expectedFailure
@
expectedFailure
...
...
product/ERP5Security/tests/testERP5Security.py
View file @
a8e749b6
...
@@ -31,9 +31,6 @@
...
@@ -31,9 +31,6 @@
"""
"""
import
unittest
import
unittest
import
transaction
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
@@ -951,7 +948,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
...
@@ -951,7 +948,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
self
.
assertTrue
(
len
(
person_module
.
keys
()))
self
.
assertTrue
(
len
(
person_module
.
keys
()))
# When we update security of a module...
# When we update security of a module...
person_module
.
reindexObjectSecurity
()
person_module
.
reindexObjectSecurity
()
transaction
.
commit
()
self
.
commit
()
# we don't want all underlying objects to be recursively
# we don't want all underlying objects to be recursively
# reindexed. After all, its contents do not acquire local roles.
# reindexed. After all, its contents do not acquire local roles.
check
([
'immediateReindexObject'
])
check
([
'immediateReindexObject'
])
...
@@ -963,7 +960,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
...
@@ -963,7 +960,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
for
rec
in
person_module
.
searchFolder
(
reference
=
self
.
username
)]
for
rec
in
person_module
.
searchFolder
(
reference
=
self
.
username
)]
self
.
assertTrue
(
len
(
person
.
objectIds
()))
self
.
assertTrue
(
len
(
person
.
objectIds
()))
person
.
reindexObjectSecurity
()
person
.
reindexObjectSecurity
()
transaction
.
commit
()
self
.
commit
()
check
([
'recursiveImmediateReindexObject'
])
check
([
'recursiveImmediateReindexObject'
])
self
.
tic
()
self
.
tic
()
...
...
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