Add skipif to tests that require connecting to OpenNebula

This commit is contained in:
PCoder 2017-11-26 00:55:14 +01:00
commit 2bc4db1cab
2 changed files with 35 additions and 3 deletions

View file

@ -1,13 +1,21 @@
import random
import string
from django.conf import settings
from django.test import TestCase
from unittest import skipIf
from .models import OpenNebulaManager
from .serializers import VirtualMachineSerializer
from utils.models import CustomUser
@skipIf(
settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is
"test_domain",
"""OpenNebula details unavailable, so skipping
OpenNebulaManagerTestCases"""
)
class OpenNebulaManagerTestCases(TestCase):
"""This class defines the test suite for the opennebula manager model."""
@ -119,7 +127,12 @@ class OpenNebulaManagerTestCases(TestCase):
"""Test the opennebula manager requires the user to have a ssh key when
creating a new vm"""
@skipIf(
settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is
"test_domain",
"""OpenNebula details unavailable, so skipping
VirtualMachineSerializerTestCase"""
)
class VirtualMachineSerializerTestCase(TestCase):
def setUp(self):
"""Define the test client and other test variables."""