-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport rudimentary content type tests from templer.dexterity.
- Loading branch information
Showing
5 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...skel/dexterity/localcommands/templates/dexterity/content/+contenttype_classname+.txt_tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
${contenttype_classname} Tests | ||
----------------- | ||
|
||
This is a DocTest file, using the Python doctest format. | ||
|
||
|
||
Create a ${contenttype_classname} object and put it in a folder | ||
|
||
Create the object:: | ||
|
||
>>> from zope.component import createObject | ||
>>> container = createObject('${contenttype_dottedname}') | ||
|
||
Verify it's type:: | ||
|
||
>>> container.portal_type | ||
'${contenttype_dottedname}' | ||
|
||
Give it a title:: | ||
|
||
>>> container.setTitle('Test Title') | ||
>>> container.Title() | ||
'Test Title' | ||
|
||
Put it in our base folder:: | ||
|
||
>>> from plone.dexterity.utils import addContentToContainer | ||
>>> cobj = addContentToContainer(folder, container) | ||
|
||
>>> cobj | ||
<${contenttype_classname} at /plone/Members/test_user_1_/test-title> | ||
|
||
>>> folder['test-title'].Title() | ||
'Test Title' | ||
|
||
Now, let's demonstrate a failing test:: | ||
|
||
>>> 2 == 3 # Deliberately failing test; fix me! | ||
True |
8 changes: 8 additions & 0 deletions
8
zopeskel/dexterity/localcommands/templates/dexterity/content/tests.py_insert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
\# Integration tests for ${contenttype_classname} | ||
ztc.ZopeDocFileSuite( | ||
'${contenttype_classname}.txt', | ||
package='${namespace_package}.${package}', | ||
optionflags = OPTION_FLAGS, | ||
test_class=TestCase), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters