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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
404d3603
authored
Apr 17, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: update tests
parent
e7d82c3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
circle/dashboard/tests/test_views.py
+13
-6
No files found.
circle/dashboard/tests/test_views.py
View file @
404d3603
...
@@ -493,9 +493,11 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -493,9 +493,11 @@ class VmDetailTest(LoginMixin, TestCase):
mock_method
.
side_effect
=
inst
.
wake_up
mock_method
.
side_effect
=
inst
.
wake_up
inst
.
manual_state_change
(
'RUNNING'
)
inst
.
manual_state_change
(
'RUNNING'
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
self
.
assertRaises
(
inst
.
WrongStateError
,
c
.
post
,
with
patch
(
'dashboard.views.messages'
)
as
msg
:
"/dashboard/vm/1/"
,
{
'wake_up'
:
True
})
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
self
.
assertEqual
(
inst
.
status
,
'RUNNING'
)
assert
msg
.
error
.
called
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
self
.
assertEqual
(
inst
.
status
,
'RUNNING'
)
# mocked anyway
assert
mock_method
.
called
assert
mock_method
.
called
def
test_permitted_wake_up
(
self
):
def
test_permitted_wake_up
(
self
):
...
@@ -509,7 +511,9 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -509,7 +511,9 @@ class VmDetailTest(LoginMixin, TestCase):
inst
.
get_remote_queue_name
=
Mock
(
return_value
=
'test'
)
inst
.
get_remote_queue_name
=
Mock
(
return_value
=
'test'
)
inst
.
manual_state_change
(
'SUSPENDED'
)
inst
.
manual_state_change
(
'SUSPENDED'
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
response
=
c
.
post
(
"/dashboard/vm/1/"
,
{
'wake_up'
:
True
})
with
patch
(
'dashboard.views.messages'
)
as
msg
:
response
=
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
assert
not
msg
.
error
.
called
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
inst
.
status
,
'RUNNING'
)
self
.
assertEqual
(
inst
.
status
,
'RUNNING'
)
assert
new_wake_up
.
called
assert
new_wake_up
.
called
...
@@ -521,8 +525,11 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -521,8 +525,11 @@ class VmDetailTest(LoginMixin, TestCase):
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
manual_state_change
(
'SUSPENDED'
)
inst
.
manual_state_change
(
'SUSPENDED'
)
inst
.
set_level
(
self
.
u2
,
'user'
)
inst
.
set_level
(
self
.
u2
,
'user'
)
response
=
c
.
post
(
"/dashboard/vm/1/"
,
{
'wake_up'
:
True
})
with
patch
(
'dashboard.views.messages'
)
as
msg
:
self
.
assertEqual
(
response
.
status_code
,
403
)
response
=
c
.
post
(
"/dashboard/vm/1/op/wake_up/"
)
assert
msg
.
error
.
called
self
.
assertEqual
(
response
.
status_code
,
302
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
self
.
assertEqual
(
inst
.
status
,
'SUSPENDED'
)
self
.
assertEqual
(
inst
.
status
,
'SUSPENDED'
)
def
test_non_existing_template_get
(
self
):
def
test_non_existing_template_get
(
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