Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6e443d3e
authored
Mar 09, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: is_running property for Instances
parent
9f60b684
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
circle/vm/models/instance.py
+4
-0
circle/vm/tests/test_models.py
+8
-0
No files found.
circle/vm/models/instance.py
View file @
6e443d3e
...
...
@@ -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.
"""
...
...
circle/vm/tests/test_models.py
View file @
6e443d3e
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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment