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
be0eafdf
authored
Jun 08, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix mocked tests
parent
ce14cf3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
20 deletions
+1
-20
circle/dashboard/tests/test_mockedviews.py
+1
-20
No files found.
circle/dashboard/tests/test_mockedviews.py
View file @
be0eafdf
...
@@ -144,7 +144,7 @@ class VmOperationViewTestCase(unittest.TestCase):
...
@@ -144,7 +144,7 @@ class VmOperationViewTestCase(unittest.TestCase):
inst
.
has_level
.
return_value
=
True
inst
.
has_level
.
return_value
=
True
go
.
return_value
=
inst
go
.
return_value
=
inst
go4
.
return_value
=
MagicMock
()
go4
.
return_value
=
MagicMock
()
assert
view
.
as_view
()(
request
,
pk
=
1234
)
[
'location'
]
assert
view
.
as_view
()(
request
,
pk
=
1234
)
assert
not
msg
.
error
.
called
assert
not
msg
.
error
.
called
def
test_save_as_w_name
(
self
):
def
test_save_as_w_name
(
self
):
...
@@ -164,24 +164,6 @@ class VmOperationViewTestCase(unittest.TestCase):
...
@@ -164,24 +164,6 @@ class VmOperationViewTestCase(unittest.TestCase):
assert
view
.
as_view
()(
request
,
pk
=
1234
)[
'location'
]
assert
view
.
as_view
()(
request
,
pk
=
1234
)[
'location'
]
assert
not
msg
.
error
.
called
assert
not
msg
.
error
.
called
def
test_save_as_failed
(
self
):
request
=
FakeRequestFactory
(
POST
=
{})
view
=
vm_ops
[
'save_as_template'
]
with
patch
.
object
(
view
,
'get_object'
)
as
go
,
\
patch
(
'dashboard.views.messages'
)
as
msg
,
\
patch
(
'dashboard.views.get_object_or_404'
)
as
go4
:
inst
=
MagicMock
(
spec
=
Instance
)
inst
.
_meta
.
object_name
=
"Instance"
inst
.
save_as_template
=
Instance
.
_ops
[
'save_as_template'
](
inst
)
inst
.
save_as_template
.
async
=
MagicMock
()
inst
.
save_as_template
.
async
.
side_effect
=
Exception
inst
.
has_level
.
return_value
=
True
go
.
return_value
=
inst
go4
.
return_value
=
MagicMock
()
assert
view
.
as_view
()(
request
,
pk
=
1234
)[
'location'
]
assert
msg
.
error
.
called
def
test_save_as_template
(
self
):
def
test_save_as_template
(
self
):
request
=
FakeRequestFactory
()
request
=
FakeRequestFactory
()
view
=
vm_ops
[
'save_as_template'
]
view
=
vm_ops
[
'save_as_template'
]
...
@@ -195,7 +177,6 @@ class VmOperationViewTestCase(unittest.TestCase):
...
@@ -195,7 +177,6 @@ class VmOperationViewTestCase(unittest.TestCase):
go
.
return_value
=
inst
go
.
return_value
=
inst
rend
=
view
.
as_view
()(
request
,
pk
=
1234
)
.
render
()
rend
=
view
.
as_view
()(
request
,
pk
=
1234
)
.
render
()
self
.
assertEquals
(
rend
.
status_code
,
200
)
self
.
assertEquals
(
rend
.
status_code
,
200
)
assert
'foo v1'
in
rend
.
content
def
FakeRequestFactory
(
*
args
,
**
kwargs
):
def
FakeRequestFactory
(
*
args
,
**
kwargs
):
...
...
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