This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
214 additions
and
82 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
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
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
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import grok | ||
|
||
from ${package} import resource | ||
|
||
class ${app_class_name}(grok.Application, grok.Container): | ||
pass | ||
|
||
class Index(grok.View): | ||
pass # see app_templates/index.pt | ||
def update(self): | ||
resource.style.need() |
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 was deleted.
Oops, something went wrong.
Empty file.
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
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
grokproject/template/src/+package+/tests/test_+project_lowercase+.py_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,31 @@ | ||
import unittest | ||
|
||
from zope.component import queryMultiAdapter | ||
from zope.publisher.browser import TestRequest | ||
|
||
from zope.fanstatic.testing import ZopeFanstaticBrowserLayer | ||
|
||
import ${package}.tests | ||
from ${package}.app import ${app_class_name} | ||
|
||
# In this file we create a unittest, a functional unittest. | ||
|
||
class MyTestCase(unittest.TestCase): | ||
|
||
def test_foo(self): | ||
self.assertEqual(1, 1) | ||
|
||
browser_layer = ZopeFanstaticBrowserLayer(${package}.tests) | ||
|
||
class MyFunctionalTestCase(unittest.TestCase): | ||
|
||
layer = browser_layer | ||
|
||
def test_foo(self): | ||
index = queryMultiAdapter((${app_class_name}(), TestRequest()), name='index') | ||
self.assertNotEqual(index, None) | ||
|
||
# There is no view called 'index2' | ||
index2 = queryMultiAdapter((${app_class_name}(), TestRequest()), name='index2') | ||
self.assertEqual(index2, None) | ||
|
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,28 @@ | ||
# The tests in test_${project_lowercase}.py are picked up by zope.testrunner. | ||
|
||
# When decorating a unittest.TestCase or doctest with a layer, the layer is | ||
# used to group tests and execute setup and teardown of the grok environment | ||
# for the test to run in. | ||
|
||
import unittest | ||
import doctest | ||
|
||
from zope.fanstatic.testing import ZopeFanstaticBrowserLayer | ||
|
||
import ${package}.tests | ||
|
||
browser_layer = ZopeFanstaticBrowserLayer(${package}.tests) | ||
|
||
def test_suite(): | ||
suite = unittest.TestSuite() | ||
|
||
app_test = doctest.DocFileSuite('app.txt', # Add more doctest files here. | ||
optionflags = ( | ||
doctest.ELLIPSIS + | ||
doctest.NORMALIZE_WHITESPACE + | ||
doctest.REPORT_NDIFF), | ||
globs={'getRootFolder': browser_layer.getRootFolder}) | ||
app_test.layer = browser_layer | ||
|
||
suite.addTest(app_test) | ||
return suite |
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
Oops, something went wrong.