Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
865a8ba5
authored
Jul 22, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test
parent
fd609634
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
circle/dashboard/tests/test_views.py
+3
-5
circle/vm/tests/test_models.py
+2
-2
No files found.
circle/dashboard/tests/test_views.py
View file @
865a8ba5
...
@@ -536,7 +536,7 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -536,7 +536,7 @@ class VmDetailTest(LoginMixin, TestCase):
with
patch
.
object
(
WakeUpOperation
,
'async'
)
as
mock_method
:
with
patch
.
object
(
WakeUpOperation
,
'async'
)
as
mock_method
:
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
mock_method
.
side_effect
=
inst
.
wake_up
mock_method
.
side_effect
=
inst
.
wake_up
inst
.
manual_state_change
(
'RUNNING'
)
inst
.
status
=
'RUNNING'
inst
.
set_level
(
self
.
u2
,
'owner'
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
with
patch
(
'dashboard.views.messages'
)
as
msg
:
with
patch
(
'dashboard.views.messages'
)
as
msg
:
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
...
@@ -554,7 +554,7 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -554,7 +554,7 @@ class VmDetailTest(LoginMixin, TestCase):
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
new_wake_up
.
side_effect
=
inst
.
wake_up
new_wake_up
.
side_effect
=
inst
.
wake_up
inst
.
get_remote_queue_name
=
Mock
(
return_value
=
'test'
)
inst
.
get_remote_queue_name
=
Mock
(
return_value
=
'test'
)
inst
.
manual_state_change
(
'SUSPENDED'
)
inst
.
status
=
'SUSPENDED'
inst
.
set_level
(
self
.
u2
,
'owner'
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
with
patch
(
'dashboard.views.messages'
)
as
msg
:
with
patch
(
'dashboard.views.messages'
)
as
msg
:
response
=
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
response
=
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
...
@@ -568,12 +568,10 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -568,12 +568,10 @@ class VmDetailTest(LoginMixin, TestCase):
c
=
Client
()
c
=
Client
()
self
.
login
(
c
,
"user2"
)
self
.
login
(
c
,
"user2"
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
manual_state_change
(
'SUSPENDED'
)
inst
.
status
=
'SUSPENDED'
inst
.
set_level
(
self
.
u2
,
'user'
)
inst
.
set_level
(
self
.
u2
,
'user'
)
response
=
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
response
=
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
403
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
self
.
assertEqual
(
inst
.
status
,
'SUSPENDED'
)
def
test_non_existing_template_get
(
self
):
def
test_non_existing_template_get
(
self
):
c
=
Client
()
c
=
Client
()
...
...
circle/vm/tests/test_models.py
View file @
865a8ba5
...
@@ -66,8 +66,8 @@ class InstanceTestCase(TestCase):
...
@@ -66,8 +66,8 @@ class InstanceTestCase(TestCase):
inst
=
MagicMock
(
spec
=
Instance
,
node
=
node
,
vnc_port
=
port
)
inst
=
MagicMock
(
spec
=
Instance
,
node
=
node
,
vnc_port
=
port
)
inst
.
save
.
side_effect
=
AssertionError
inst
.
save
.
side_effect
=
AssertionError
with
patch
(
'vm.models.instance.InstanceActivity'
)
as
ia
:
with
patch
(
'vm.models.instance.InstanceActivity'
)
as
ia
:
ia
.
create
.
side_effect
=
ActivityInProgressError
(
MagicMock
())
ia
.
create
.
side_effect
=
ActivityInProgressError
.
create
(
MagicMock
())
Instance
.
vm_state_changed
(
inst
,
'STOPPED'
)
Instance
.
status
=
'STOPPED'
self
.
assertEquals
(
inst
.
node
,
node
)
self
.
assertEquals
(
inst
.
node
,
node
)
self
.
assertEquals
(
inst
.
vnc_port
,
port
)
self
.
assertEquals
(
inst
.
vnc_port
,
port
)
...
...
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