test_operations.py 2.03 KB
Newer Older
1 2
from django.test import TestCase

3
from common.operations import operation_registry_name as op_reg_name
4 5
from vm.models import Instance
from vm.operations import (
6
    DeployOperation, DestroyOperation, MigrateOperation,
7 8 9 10
    RebootOperation, RedeployOperation, ResetOperation,
    SaveAsTemplateOperation, ShutdownOperation, ShutOffOperation,
    SleepOperation, WakeUpOperation,
)
11

12 13 14

class DeployOperationTestCase(TestCase):
    def test_operation_registered(self):
15
        assert DeployOperation.id in getattr(Instance, op_reg_name)
16 17 18 19


class DestroyOperationTestCase(TestCase):
    def test_operation_registered(self):
20
        assert DestroyOperation.id in getattr(Instance, op_reg_name)
21 22 23 24


class MigrateOperationTestCase(TestCase):
    def test_operation_registered(self):
25
        assert MigrateOperation.id in getattr(Instance, op_reg_name)
26 27 28 29


class RebootOperationTestCase(TestCase):
    def test_operation_registered(self):
30
        assert RebootOperation.id in getattr(Instance, op_reg_name)
31 32 33 34


class RedeployOperationTestCase(TestCase):
    def test_operation_registered(self):
35
        assert RedeployOperation.id in getattr(Instance, op_reg_name)
36 37 38 39


class ResetOperationTestCase(TestCase):
    def test_operation_registered(self):
40
        assert ResetOperation.id in getattr(Instance, op_reg_name)
41 42 43 44


class SaveAsTemplateOperationTestCase(TestCase):
    def test_operation_registered(self):
45
        assert SaveAsTemplateOperation.id in getattr(Instance, op_reg_name)
46 47 48 49


class ShutdownOperationTestCase(TestCase):
    def test_operation_registered(self):
50
        assert ShutdownOperation.id in getattr(Instance, op_reg_name)
51 52 53 54


class ShutOffOperationTestCase(TestCase):
    def test_operation_registered(self):
55
        assert ShutOffOperation.id in getattr(Instance, op_reg_name)
56 57 58 59


class SleepOperationTestCase(TestCase):
    def test_operation_registered(self):
60
        assert SleepOperation.id in getattr(Instance, op_reg_name)
61 62 63 64


class WakeUpOperationTestCase(TestCase):
    def test_operation_registered(self):
65
        assert WakeUpOperation.id in getattr(Instance, op_reg_name)