Skip to content

Commit

Permalink
Add additional registrations and assertions for adding.py in ftesting…
Browse files Browse the repository at this point in the history
….zcml

Also some whitespace cleanups.
  • Loading branch information
jamadden committed Apr 23, 2017
1 parent 3b23e24 commit a30576f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
Expand Up @@ -88,7 +88,9 @@ def test_inplace_add(self):
form={'type_name': u'BrowserAdd__zope.site.folder.Folder'})
body = response.unicode_normal_body
self.assertIn('type="hidden" name="type_name"', body)
self.assertIn('input name="new_value"', body)
self.assertIn('type="submit" name="container_cancel_button"', body)
self.assertNotIn('type="submit" name="container_rename_button"', body)

response = self.publish(
'/@@contents.html',
Expand Down Expand Up @@ -348,15 +350,15 @@ def test_copy_then_delete_with_unicode_name(self):
basic='mgr:mgrpw',
form={
'ids:list' : u'voil\xe0'.encode('utf-8'),
'container_copy_button' : ''
'container_copy_button': '',
},
headers={
'Accept-Charset': 'latin-1, utf-8',
},
)
self.assertEqual(response.status_int, 302)
self.assertEqual(response.headers.get('Location'),
'http://localhost/@@contents.html')
'http://localhost/@@contents.html')
response = self.publish('/@@contents.html', basic='mgr:mgrpw')
self.assertEqual(response.status_int, 200)

Expand Down
37 changes: 31 additions & 6 deletions src/zope/app/container/ftesting.zcml
Expand Up @@ -44,7 +44,27 @@
<include package="zope.securitypolicy" />
<include package="zope.login" />

<!-- Needs zope.app.localpermission to be ported -->
<!-- These normally come from zope.app.zcmlfiles/menus.zcml -->
<browser:menu
id="zmi_views"
title="Views"
description="Menu for displaying alternate representations of an object"
/>

<browser:menu
id="zmi_actions"
title="Actions"
description="Menu for displaying actions to be performed"
/>

<browser:menu
id="zope.app.container.add"
title="Add"
description="Menu for objects to be added according to
containment constraints"
interface="zope.app.publisher.interfaces.browser.AddMenu"
/>

<!-- <include package="zope.app.security" /> -->
<browser:defaultView name="index.html" />
<!-- These came from zope.app.component for some reason -->
Expand All @@ -67,6 +87,16 @@
>
<browser:page name="index.html" attribute="index" />
</browser:pages>
<browser:view
name="+"
menu="zmi_actions" title="Add Site Management Folder"
for="zope.site.interfaces.IFolder"
permission="zope.ManageSite"
class="zope.app.container.browser.adding.Adding"
>
<browser:page name="index.html" attribute="index"/>
<browser:page name="action.html" attribute="action"/>
</browser:view>

<!-- This normally comes from zope.app.folder -->
<browser:addMenuItem
Expand All @@ -76,11 +106,6 @@
permission="zope.ManageContent"
/>

<browser:menu
id="zmi_views"
title="Views"
description="Menu for displaying alternate representations of an object"
/>

<include package="zope.app.container.browser.tests" />

Expand Down
6 changes: 1 addition & 5 deletions src/zope/app/container/testing.py
Expand Up @@ -2,11 +2,7 @@

from zope.container.testing import setUp as cSetUp, tearDown as cTearDown

try:
from zope.testing.cleanup import tearDown as tTearDown
except ImportError: # pragma: no cover
def tTearDown():
pass
from zope.testing.cleanup import tearDown as tTearDown

from zope.app.wsgi.testlayer import BrowserLayer

Expand Down

0 comments on commit a30576f

Please sign in to comment.