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:
parent
6533205479
commit
30600ce107
2 changed files with 666 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue