Skip to content

Commit

Permalink
Added test_ajax_addAction
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Oct 16, 2013
1 parent 21e9e01 commit 0a50c86
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion quintagroup/plonetabs/browser/plonetabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def manage_ajax_addAction(self, form, errs):
# extract posted data
resp_dict = {}
cat_name = form['category']
id, ie7bad_category, data = self.parseAddForm(self.request.form)
id, ie7bad_category, data = self.parseAddForm(form)

# validate posted data
errors = self.validateActionFields(cat_name, data)
Expand Down
33 changes: 33 additions & 0 deletions quintagroup/plonetabs/tests/test_controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,39 @@ def afterSetUp(self):
self.panel = panel.__of__(self.portal)
self.tool = getToolByName(self.portal, 'portal_actions')

def test_renderPanel(self):
response = self.panel()
self.assertTrue('Portal Tabs Configuration' in response)

def test_ajax_addAction(self):
form = {
#'add_add': 'Add',
#'ajax_request': True,
'available_expr': '',
'category': 'site_actions',
'description': '',
#'form.submitted:boolean': True,
'icon_expr': '',
'id': '',
'title': '',
'url_expr': '',
'visible': 1,
}
response = self.panel.manage_ajax_addAction(form, None)
self.assertEquals(response, {
'content': {
'id': u'Empty or invalid id specified',
'title': u'Empty or invalid title specified'
},
'status_code': 500,
'status_message': u'Please correct the indicated errors.'
})
form['id'] = 'action_id'
form['title'] = 'action title'
response = self.panel.manage_ajax_addAction(form, None)
self.assertEquals(response['status_code'], 200)
self.assertEquals(response['status_message'], u"'action_id' action successfully added.")

def test_redirect(self):
response = self.portal.REQUEST.RESPONSE
method = self.panel.redirect
Expand Down

0 comments on commit 0a50c86

Please sign in to comment.