Add tests for managemails.views

This commit adds a test suite for the views defined in
managemails.views. One issue discovered when writing tests is fixed by
checking the request method in CreateMailbox.dispatch.
This commit is contained in:
Jan Dittberner 2015-11-28 19:01:52 +00:00
parent 6533205479
commit 30600ce107
2 changed files with 666 additions and 4 deletions

View file

@ -46,10 +46,11 @@ class CreateMailbox(
def dispatch(self, request, *args, **kwargs):
resp = super(CreateMailbox, self).dispatch(request, *args, **kwargs)
if not self.get_hosting_package().may_add_mailbox():
resp = HttpResponseForbidden(
_('You are not allowed to add more mailboxes to this'
' hosting package'))
if request.method != 'POST':
if not self.get_hosting_package().may_add_mailbox():
resp = HttpResponseForbidden(
_('You are not allowed to add more mailboxes to this'
' hosting package'))
return resp
def get_context_data(self, **kwargs):