Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
synnefo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
synnefo
Commits
45bd654f
Commit
45bd654f
authored
12 years ago
by
Christos Stavrakakis
Browse files
Options
Downloads
Patches
Plain Diff
snf_django: Mock quotaholder to BaseAPITest
Mock quotaholder in all of BaseAPITest calls.
parent
af311de8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
snf-django-lib/snf_django/utils/testing.py
+12
-6
12 additions, 6 deletions
snf-django-lib/snf_django/utils/testing.py
with
12 additions
and
6 deletions
snf-django-lib/snf_django/utils/testing.py
+
12
−
6
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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment