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
Titouan Soulard
erp5
Commits
e4a52743
Commit
e4a52743
authored
Aug 26, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testDynamicClassGeneration: more self-explanatory assertions
parent
bc67c2c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+7
-4
No files found.
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
e4a52743
...
@@ -3035,20 +3035,23 @@ class Test(ERP5TypeTestCase):
...
@@ -3035,20 +3035,23 @@ class Test(ERP5TypeTestCase):
types_tool = self.portal.portal_types
types_tool = self.portal.portal_types
ptype = types_tool.newContent(name, type_class="File")
ptype = types_tool.newContent(name, type_class="File")
file = ptype.constructInstance(self.portal, name, data="foo")
file = ptype.constructInstance(self.portal, name, data="foo")
self.assertEqual(file.size,
3
)
self.assertEqual(file.size,
len("foo")
)
self.commit()
self.commit()
try:
try:
self.portal._p_jar.cacheMinimize()
self.portal._p_jar.cacheMinimize()
del file
del file
delattr(erp5.portal_type, name)
delattr(erp5.portal_type, name)
# Simulate a portal type using a non existing class.
# Instances of this portal type are broken and can not be modified.
ptype.setTypeClass(name)
ptype.setTypeClass(name)
self.commit()
self.commit()
file = self.portal.__dict__[name]
file = self.portal.__dict__[name]
self.assert
True(isinstance(file, InitGhostBase)
)
self.assert
IsInstance(file, InitGhostBase
)
# Check that the class is unghosted before resolving __setattr__
# Check that the class is unghosted before resolving __setattr__
self.assertRaises(BrokenModified, setattr, file, "size", 0)
self.assertRaises(BrokenModified, setattr, file, "size", 0)
self.assert
True(isinstance(file, ERP5BaseBroken)
)
self.assert
IsInstance(file, ERP5BaseBroken
)
self.assertEqual(file.size,
3
)
self.assertEqual(file.size,
len("foo")
)
finally:
finally:
self.portal._delObject(name)
self.portal._delObject(name)
types_tool._delObject(name)
types_tool._delObject(name)
...
...
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