Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-web
Commits
68da90cc
Commit
68da90cc
authored
1 year ago
by
Antoine Lambert
Browse files
Options
Downloads
Patches
Plain Diff
test_gunicorn_config: Fix test after swh-core 3.0.1 release
parent
f0191352
No related branches found
No related tags found
1 merge request
!1278
package.json: Bump dependencies
Pipeline
#8579
passed
11 months ago
Stage: external
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
requirements-swh.txt
+1
-1
1 addition, 1 deletion
requirements-swh.txt
swh/web/tests/test_gunicorn_config.py
+29
-24
29 additions, 24 deletions
swh/web/tests/test_gunicorn_config.py
with
30 additions
and
25 deletions
requirements-swh.txt
+
1
−
1
View file @
68da90cc
swh.auth[django] >= 0.6.7
swh.core >= 3.0.
0
swh.core >= 3.0.
1
swh.counters >= 0.5.1
swh.indexer >= 2.0.0
swh.model >= 6.3.0
...
...
This diff is collapsed.
Click to expand it.
swh/web/tests/test_gunicorn_config.py
+
29
−
24
View file @
68da90cc
# Copyright (C) 2019-202
0
The Software Heritage developers
# Copyright (C) 2019-202
4
The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import
os
from
unittest.mock
import
patch
import
swh.web.gunicorn_config
as
gunicorn_config
django_integration
=
object
()
# unique object to check for equality
def
test_post_fork_default
():
with
patch
(
"
sentry_sdk.init
"
)
as
sentry_sdk_init
:
gunicorn_config
.
post_fork
(
None
,
None
)
sentry_sdk_init
.
assert_not_called
()
def
test_post_fork_default
(
mocker
):
mocker
.
patch
(
"
swh.web.gunicorn_config.DjangoIntegration
"
,
new
=
lambda
:
django_integration
)
sentry_sdk_init
=
mocker
.
patch
(
"
sentry_sdk.init
"
)
gunicorn_config
.
post_fork
(
None
,
None
)
sentry_sdk_init
.
assert_called_once_with
(
dsn
=
None
,
environment
=
None
,
integrations
=
[
django_integration
],
debug
=
False
,
release
=
None
,
)
def
test_post_fork_with_dsn_env
():
django_integration
=
object
()
# unique object to check for equality
with
patch
(
def
test_post_fork_with_dsn_env
(
mocker
):
mocker
.
patch
(
"
swh.web.gunicorn_config.DjangoIntegration
"
,
new
=
lambda
:
django_integration
):
with
patch
(
"
sentry_sdk.init
"
)
as
sentry_sdk_init
:
with
patch
.
dict
(
os
.
environ
,
{
"
SWH_SENTRY_DSN
"
:
"
test_dsn
"
}):
gunicorn_config
.
post_fork
(
None
,
None
)
)
sentry_sdk_init
=
mocker
.
patch
(
"
sentry_sdk.init
"
)
mocker
.
patch
.
dict
(
os
.
environ
,
{
"
SWH_SENTRY_DSN
"
:
"
test_dsn
"
})
gunicorn_config
.
post_fork
(
None
,
None
)
sentry_sdk_init
.
assert_called_once_with
(
dsn
=
"
test_dsn
"
,
environment
=
None
,
...
...
@@ -34,17 +41,15 @@ def test_post_fork_with_dsn_env():
)
def
test_post_fork_debug
():
django_integration
=
object
()
# unique object to check for equality
with
patch
(
def
test_post_fork_debug
(
mocker
):
mocker
.
patch
(
"
swh.web.gunicorn_config.DjangoIntegration
"
,
new
=
lambda
:
django_integration
):
with
patch
(
"
sentry_sdk.init
"
)
as
sentry_sdk_init
:
with
patch
.
dict
(
os
.
environ
,
{
"
SWH_SENTRY_DSN
"
:
"
test_dsn
"
,
"
SWH_SENTRY_DEBUG
"
:
"
1
"
}
):
gunicorn_config
.
post_fork
(
None
,
None
)
)
sentry_sdk_init
=
mocker
.
patch
(
"
sentry_sdk.init
"
)
mocker
.
patch
.
dict
(
os
.
environ
,
{
"
SWH_SENTRY_DSN
"
:
"
test_dsn
"
,
"
SWH_SENTRY_DEBUG
"
:
"
1
"
}
)
gunicorn_config
.
post_fork
(
None
,
None
)
sentry_sdk_init
.
assert_called_once_with
(
dsn
=
"
test_dsn
"
,
environment
=
None
,
...
...
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