Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
45bd654f
Commit
45bd654f
authored
Jun 10, 2013
by
Christos Stavrakakis
Browse files
snf_django: Mock quotaholder to BaseAPITest
Mock quotaholder in all of BaseAPITest calls.
parent
af311de8
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-django-lib/snf_django/utils/testing.py
View file @
45bd654f
...
...
@@ -149,28 +149,34 @@ def mocked_quotaholder(success=True):
class
BaseAPITest
(
TestCase
):
def
get
(
self
,
url
,
user
=
'user'
,
*
args
,
**
kwargs
):
with
astakos_user
(
user
):
response
=
self
.
client
.
get
(
url
,
*
args
,
**
kwargs
)
with
mocked_quotaholder
():
response
=
self
.
client
.
get
(
url
,
*
args
,
**
kwargs
)
return
response
def
delete
(
self
,
url
,
user
=
'user'
):
with
astakos_user
(
user
):
response
=
self
.
client
.
delete
(
url
)
with
mocked_quotaholder
():
response
=
self
.
client
.
delete
(
url
)
return
response
def
post
(
self
,
url
,
user
=
'user'
,
params
=
{},
ctype
=
'json'
,
*
args
,
**
kwargs
):
if
ctype
==
'json'
:
content_type
=
'application/json'
with
astakos_user
(
user
):
response
=
self
.
client
.
post
(
url
,
params
,
content_type
=
content_type
,
*
args
,
**
kwargs
)
with
mocked_quotaholder
():
response
=
self
.
client
.
post
(
url
,
params
,
content_type
=
content_type
,
*
args
,
**
kwargs
)
return
response
def
put
(
self
,
url
,
user
=
'user'
,
params
=
{},
ctype
=
'json'
,
*
args
,
**
kwargs
):
if
ctype
==
'json'
:
content_type
=
'application/json'
with
astakos_user
(
user
):
response
=
self
.
client
.
put
(
url
,
params
,
content_type
=
content_type
,
*
args
,
**
kwargs
)
with
mocked_quotaholder
():
response
=
self
.
client
.
put
(
url
,
params
,
content_type
=
content_type
,
*
args
,
**
kwargs
)
return
response
def
assertSuccess
(
self
,
response
):
...
...
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