Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
1525a9fe
Commit
1525a9fe
authored
Apr 05, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish coverage for App.Extensions.getBrain.
parent
56b2f844
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
src/App/tests/test_Extensions.py
src/App/tests/test_Extensions.py
+35
-0
No files found.
src/App/tests/test_Extensions.py
View file @
1525a9fe
...
...
@@ -338,6 +338,40 @@ class Test_getObject(_TempdirBase, unittest.TestCase):
self
.
assertEqual
(
cached
[
'named'
],
'NAMED'
)
class
Test_getBrain
(
_TempdirBase
,
unittest
.
TestCase
):
def
_callFUT
(
self
,
module
,
name
,
reload
=
0
,
modules
=
None
):
from
App.Extensions
import
getBrain
if
modules
is
not
None
:
return
getBrain
(
module
,
name
,
reload
,
modules
)
return
getBrain
(
module
,
name
,
reload
)
def
test_no_module_no_class_yields_NoBrains
(
self
):
from
App.Extensions
import
NoBrains
self
.
failUnless
(
self
.
_callFUT
(
''
,
''
)
is
NoBrains
)
def
test_missing_name
(
self
):
from
App.Extensions
import
NoBrains
from
zExceptions
import
NotFound
self
.
failUnless
(
self
.
_callFUT
(
''
,
''
)
is
NoBrains
)
MODULES
=
{
'somemodule'
:
{}}
self
.
assertRaises
(
NotFound
,
self
.
_callFUT
,
'somemodule'
,
'name'
,
modules
=
MODULES
)
def
test_not_a_class
(
self
):
from
App.Extensions
import
NoBrains
self
.
failUnless
(
self
.
_callFUT
(
''
,
''
)
is
NoBrains
)
MODULES
=
{
'somemodule'
:
{
'name'
:
object
()}}
self
.
assertRaises
(
ValueError
,
self
.
_callFUT
,
'somemodule'
,
'name'
,
modules
=
MODULES
)
def
test_found_class
(
self
):
from
App.Extensions
import
NoBrains
self
.
failUnless
(
self
.
_callFUT
(
''
,
''
)
is
NoBrains
)
MODULES
=
{
'somemodule'
:
{
'name'
:
self
.
__class__
}}
self
.
assertEqual
(
self
.
_callFUT
(
'somemodule'
,
'name'
,
modules
=
MODULES
),
self
.
__class__
)
EXTENSION_PY
=
"""
\
named = 'NAMED'
"""
...
...
@@ -347,4 +381,5 @@ def test_suite():
unittest
.
makeSuite
(
FuncCodeTests
),
unittest
.
makeSuite
(
Test_getPath
),
unittest
.
makeSuite
(
Test_getObject
),
unittest
.
makeSuite
(
Test_getBrain
),
))
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