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
Mikolaï Krol
erp5
Commits
928c5819
Commit
928c5819
authored
Feb 24, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base: test that only validated currency exchange line should apply
parent
b4d0d9ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
product/ERP5/tests/testERP5CurrencyExchangeLine.py
product/ERP5/tests/testERP5CurrencyExchangeLine.py
+52
-0
No files found.
product/ERP5/tests/testERP5CurrencyExchangeLine.py
View file @
928c5819
...
...
@@ -501,6 +501,29 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
else
:
self
.
fail
(
'line not found'
)
def
test_only_validated_currency_exchange_line_applies
(
self
):
euro
=
self
.
portal
.
currency_module
.
euro
usd
=
self
.
portal
.
currency_module
.
usd
euro_to_usd
=
euro
.
newContent
(
portal_type
=
'Currency Exchange Line'
,
price_currency_value
=
usd
)
euro_to_usd
.
setBasePrice
(
1.10158
)
self
.
tic
()
context
=
self
.
_getPriceContext
(
categories
=
[
'resource/currency_module/euro'
,
'price_currency/currency_module/usd'
])
exchange_ratio
=
euro
.
getPrice
(
context
=
context
,
)
self
.
assertEqual
(
None
,
exchange_ratio
)
euro_to_usd
.
validate
()
self
.
tic
()
exchange_ratio
=
euro
.
getPrice
(
context
=
context
,
)
self
.
assertEqual
(
1.10158
,
exchange_ratio
)
def
test_date_on_currency_exchange_line
(
self
):
euro
=
self
.
portal
.
currency_module
.
euro
usd
=
self
.
portal
.
currency_module
.
usd
...
...
@@ -641,6 +664,35 @@ class TestCurrencyExchangeCell(CurrencyExchangeTestCase):
portal_type
=
'Currency Exchange Cell'
)
self
.
assertEqual
(
0.98
,
exchange_ratio
)
def
test_only_validated_currency_exchange_cell_applies
(
self
):
euro
=
self
.
portal
.
currency_module
.
euro
usd
=
self
.
portal
.
currency_module
.
usd
euro_to_usd
=
euro
.
newContent
(
portal_type
=
'Currency Exchange Line'
,
price_currency_value
=
usd
)
type_a_cell
=
euro_to_usd
.
getCell
(
'currency_exchange_type/type_a'
,
'resource/%s'
%
euro
.
getRelativeUrl
(),
'price_currency/%s'
%
usd
.
getRelativeUrl
(),
base_id
=
'path'
)
type_a_cell
.
setBasePrice
(
0.98
)
self
.
tic
()
context
=
self
.
_getPriceContext
(
categories
=
[
'resource/%s'
%
euro
.
getRelativeUrl
(),
'price_currency/%s'
%
usd
.
getRelativeUrl
(),
'currency_exchange_type/type_a'
])
exchange_ratio
=
euro
.
getPrice
(
context
=
context
,
portal_type
=
'Currency Exchange Cell'
)
self
.
assertEqual
(
None
,
exchange_ratio
)
euro_to_usd
.
validate
()
self
.
tic
()
exchange_ratio
=
euro
.
getPrice
(
context
=
context
,
portal_type
=
'Currency Exchange Cell'
)
self
.
assertEqual
(
0.98
,
exchange_ratio
)
def
test_date_on_currency_exchange_cell
(
self
):
euro
=
self
.
portal
.
currency_module
.
euro
...
...
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