Commit 6e443d3e by Dudás Ádám

vm: is_running property for Instances

parent 9f60b684
......@@ -273,6 +273,10 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
return " ".join([s for s in parts if s != ""])
@property
def is_running(self):
return self.state == 'RUNNING'
@property
def state(self):
"""State of the virtual machine instance.
"""
......
from django.test import TestCase
from mock import Mock
from ..models.common import (
Lease
......@@ -32,6 +33,13 @@ class TemplateTestCase(TestCase):
# TODO add images & net
class InstanceTestCase(TestCase):
def test_is_running(self):
inst = Mock(state='RUNNING')
assert Instance.is_running.getter(inst)
class InterfaceTestCase(TestCase):
def test_interface_create(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment