Add test for userdbs.views.AddUserDatabase
This commit adds tests for userdbs.views.AddUserDatabase, the view itself has been modified so that it is only reachable when the hosting package actually has database options available.
This commit is contained in:
parent
e9fc8b7f89
commit
e6c38b632b
2 changed files with 206 additions and 0 deletions
|
@ -4,6 +4,7 @@ This module defines views for user database handling.
|
|||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.core.exceptions import SuspiciousOperation
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic.edit import (
|
||||
|
@ -48,6 +49,9 @@ class AddUserDatabase(
|
|||
db_user__db_type=opt['db_type']).count()
|
||||
if dbs_of_type < opt['number']:
|
||||
retval.append((opt['db_type'], DB_TYPES[opt['db_type']]))
|
||||
if len(retval) < 1:
|
||||
raise SuspiciousOperation(
|
||||
_("The hosting package has no database products assigned."))
|
||||
return retval
|
||||
|
||||
def get_form_kwargs(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue