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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
c80acc97
Commit
c80acc97
authored
Sep 02, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: erp5_commerce: Migrate Unit Test.
parent
dc7fc5e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
17 deletions
+131
-17
bt5/erp5_commerce/TestTemplateItem/portal_components/test.erp5.testERP5Commerce.py
...plateItem/portal_components/test.erp5.testERP5Commerce.py
+14
-17
bt5/erp5_commerce/TestTemplateItem/portal_components/test.erp5.testERP5Commerce.xml
...lateItem/portal_components/test.erp5.testERP5Commerce.xml
+110
-0
bt5/erp5_commerce/bt/template_test_id_list
bt5/erp5_commerce/bt/template_test_id_list
+1
-0
bt5/erp5_commerce/bt/test_dependency_list
bt5/erp5_commerce/bt/test_dependency_list
+6
-0
No files found.
product/ERP5/tests/
testERP5Commerce.py
→
bt5/erp5_commerce/TestTemplateItem/portal_components/test.erp5.
testERP5Commerce.py
View file @
c80acc97
...
...
@@ -204,18 +204,18 @@ class TestCommerce(ERP5TypeTestCase):
"""
self
.
organisation_module
=
self
.
portal
.
getDefaultModule
(
'Organisation'
)
if
'seller'
not
in
self
.
organisation_module
.
objectIds
():
self
.
nexedi
=
self
.
organisation_module
.
newContent
(
title
=
"Seller"
,
self
.
nexedi
=
self
.
organisation_module
.
newContent
(
title
=
"Seller"
,
group
=
'seller'
,
role
=
'internal'
,
id
=
'seller'
)
def
createTestUser
(
self
,
first_name
,
last_name
,
reference
,
group
,
destination_project
=
None
,
id
=
None
):
destination_project
=
None
):
"""
Create a user with the given parameters
"""
self
.
person_module
=
self
.
getPersonModule
()
if
hasattr
(
self
.
person_module
,
id
or
reference
):
if
hasattr
(
self
.
person_module
,
reference
):
return
person
=
self
.
person_module
.
newContent
(
first_name
=
first_name
,
...
...
@@ -223,7 +223,7 @@ class TestCommerce(ERP5TypeTestCase):
reference
=
reference
,
password
=
'secret'
,
career_role
=
'internal'
,
id
=
id
or
reference
,
id
=
reference
,
)
# Set the assignment
...
...
@@ -240,7 +240,7 @@ class TestCommerce(ERP5TypeTestCase):
self
.
portal
.
acl_users
.
zodb_roles
.
assignRoleToPrincipal
(
'Manager'
,
person
.
Person_getUserId
())
def
getDefaultProduct
(
self
,
id
=
'1'
):
def
getDefaultProduct
(
self
,
id
=
'1'
):
# pylint: disable=redefined-builtin
"""
Get default product.
"""
...
...
@@ -308,7 +308,7 @@ class TestCommerce(ERP5TypeTestCase):
ups
.
publish
()
self
.
tic
()
def
createUser
(
self
,
name
,
role_list
):
def
createUser
(
self
,
name
,
role_list
):
# pylint: disable=arguments-differ
user_folder
=
self
.
portal
.
acl_users
user_folder
.
_doAddUser
(
name
,
'password'
,
role_list
,
[])
...
...
@@ -444,7 +444,6 @@ class TestCommerce(ERP5TypeTestCase):
self
.
website
.
Resource_addToShoppingCart
(
default_product
,
1
)
self
.
website
.
Resource_addToShoppingCart
(
another_product
,
1
)
shopping_cart
=
self
.
portal
.
SaleOrder_getShoppingCart
()
self
.
assertEqual
(
40.0
,
\
float
(
self
.
website
.
SaleOrder_getShoppingCartTotalPrice
()))
# include taxes (by default it's 20%)
...
...
@@ -484,7 +483,6 @@ class TestCommerce(ERP5TypeTestCase):
self
.
website
.
Resource_addToShoppingCart
(
default_product
,
quantity
=
1
)
self
.
website
.
Resource_addToShoppingCart
(
another_product
,
quantity
=
1
)
shopping_cart
=
self
.
portal
.
SaleOrder_getShoppingCart
()
shipping_url
=
shipping
.
getRelativeUrl
()
# increase shopping item number and set shipping
...
...
@@ -523,11 +521,10 @@ class TestCommerce(ERP5TypeTestCase):
"""
Test clear of shopping cart.
"""
default_product
=
self
.
getDefaultProduct
()
self
.
createShoppingCartWithProductListAndShipping
()
self
.
tic
()
s
hopping_cart
=
s
elf
.
website
.
SaleOrder_getShoppingCart
(
action
=
'reset'
)
self
.
website
.
SaleOrder_getShoppingCart
(
action
=
'reset'
)
self
.
assertEqual
(
0
,
len
(
self
.
website
.
SaleOrder_getShoppingCartItemList
()))
def
test_07_SessionIDGeneration
(
self
):
...
...
@@ -636,7 +633,6 @@ class TestCommerce(ERP5TypeTestCase):
"""
Test the SaleOrder_getAvailableShippingResourceList script
"""
default_product
=
self
.
getDefaultProduct
()
product_line
=
self
.
portal
.
portal_categories
.
product_line
shipping_url
=
product_line
.
shipping
.
getRelativeUrl
()
self
.
portal
.
product_module
.
newContent
(
portal_type
=
'Product'
,
...
...
@@ -652,9 +648,9 @@ class TestCommerce(ERP5TypeTestCase):
"""
sale_order
=
self
.
portal
.
sale_order_module
.
newContent
(
portal_type
=
"Sale Order"
)
sale_order
_line
=
sale_order
.
newContent
(
portal_type
=
"Sale Order Line"
,
quantity
=
"2"
,
price
=
"10"
)
sale_order
.
newContent
(
portal_type
=
"Sale Order Line"
,
quantity
=
"2"
,
price
=
"10"
)
self
.
assertEqual
(
sale_order
.
getCreationDate
().
strftime
(
'%a, %d %b %Y %H:%M %p'
),
...
...
@@ -811,7 +807,6 @@ class TestCommerce(ERP5TypeTestCase):
"""
default_product
=
self
.
getDefaultProduct
(
id
=
'1'
)
self
.
website
.
Resource_addToShoppingCart
(
default_product
,
1
)
shopping_cart
=
self
.
website
.
SaleOrder_getShoppingCart
()
# add shipping
shipping
=
self
.
getDefaultProduct
(
'3'
)
...
...
@@ -886,8 +881,10 @@ class TestCommerce(ERP5TypeTestCase):
Anonymous user must be able to get product image.
"""
product
=
self
.
getDefaultProduct
()
file_upload
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'images'
,
'erp5_logo_small.png'
))
import
Products.ERP5.tests
file_upload
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
Products
.
ERP5
.
tests
.
__file__
),
'test_data'
,
'images'
,
'erp5_logo_small.png'
))
product
.
edit
(
default_image_file
=
file_upload
)
self
.
tic
()
...
...
bt5/erp5_commerce/TestTemplateItem/portal_components/test.erp5.testERP5Commerce.xml
0 → 100644
View file @
c80acc97
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5Commerce
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testERP5Commerce
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testERP5Commerce
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_commerce/bt/template_test_id_list
0 → 100644
View file @
c80acc97
test.erp5.testERP5Commerce
\ No newline at end of file
bt5/erp5_commerce/bt/test_dependency_list
0 → 100644
View file @
c80acc97
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_base
erp5_simulation
erp5_configurator_standard_trade_template
erp5_simulation_test
\ No newline at end of file
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