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
2f359c8d
Commit
2f359c8d
authored
Mar 21, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: minimal test for ERP5TypeTestCase.pinDateTime
This tests the test framework, because this code is tricky.
parent
cb709f92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testDateUtils.py
...TemplateItem/portal_components/test.erp5.testDateUtils.py
+17
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testDateUtils.py
View file @
2f359c8d
...
...
@@ -32,6 +32,7 @@ import unittest
from
DateTime
import
DateTime
from
erp5.component.module.DateUtils
import
addToDate
,
getIntervalListBetweenDates
,
\
atTheEndOfPeriod
,
getClosestDate
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
TestDateUtils
(
unittest
.
TestCase
):
"""
...
...
@@ -175,7 +176,23 @@ class TestDateUtils(unittest.TestCase):
self
.
assertEqual
(
'Sep. 10, 2008 12:00 am GMT-2'
,
getClosestDate
(
date
=
date
,
target_date
=
target_date
,
precision
=
'month'
,
before
=
False
).
pCommonZ
())
class
TestPinDateTime
(
ERP5TypeTestCase
):
def
test_pinDateTime
(
self
):
actual_begin_date
=
DateTime
()
datetime
=
DateTime
(
'2001/01/01 01:01:01'
)
fixed_date_with_timezone
=
DateTime
(
'2002/02/02 02:02:02 GMT+2'
)
self
.
pinDateTime
(
datetime
)
self
.
assertEqual
(
DateTime
(),
datetime
)
self
.
assertEqual
(
DateTime
(
'2002/02/02 02:02:02 GMT+2'
),
fixed_date_with_timezone
)
self
.
unpinDateTime
()
self
.
assertGreaterEqual
(
DateTime
(),
actual_begin_date
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestDateUtils
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestPinDateTime
))
return
suite
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