forked from Hostea/dashboard
feat: test vm name validation
parent
011fb4816f
commit
bcb2e26f61
|
@ -30,6 +30,7 @@ from payments import get_payment_model, RedirectNeeded, PaymentStatus
|
|||
from accounts.tests import login_util, register_util
|
||||
|
||||
from .models import InstanceConfiguration, Instance
|
||||
from .utils import create_instance, VmErrors, VmException
|
||||
|
||||
|
||||
def create_configurations(t: TestCase):
|
||||
|
@ -197,6 +198,27 @@ class CreateInstance(TestCase):
|
|||
register_util(t=self, username="createinstance_user")
|
||||
create_configurations(t=self)
|
||||
|
||||
@override_settings(
|
||||
HOSTEA=infra_custom_config(test_name="test_create_instance_util")
|
||||
)
|
||||
def test_create_instance_util(self):
|
||||
vm_name = "test_create_instance_renders"
|
||||
configuration = self.instance_config[0].name
|
||||
|
||||
with self.assertRaises(VmException):
|
||||
create_instance(
|
||||
vm_name="12345452131324234234234234",
|
||||
configuration_name=configuration,
|
||||
user=self.user,
|
||||
)
|
||||
|
||||
with self.assertRaises(VmException):
|
||||
create_instance(
|
||||
vm_name="122342$#34234",
|
||||
configuration_name=configuration,
|
||||
user=self.user,
|
||||
)
|
||||
|
||||
@override_settings(
|
||||
HOSTEA=infra_custom_config(test_name="test_create_instance_renders")
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue