Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
c7557127
Commit
c7557127
authored
6 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a system check for GitLab settings
parent
210db4b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/project/checks.py
+22
-0
22 additions, 0 deletions
arkindex/project/checks.py
arkindex/project/tests/test_checks.py
+25
-0
25 additions, 0 deletions
arkindex/project/tests/test_checks.py
with
47 additions
and
0 deletions
arkindex/project/checks.py
+
22
−
0
View file @
c7557127
...
...
@@ -230,3 +230,25 @@ def internal_group_check(*args, **kwargs):
id
=
'
arkindex.W002
'
,
)]
return
[]
@register
()
@only_runserver
def
gitlab_oauth_check
(
*
args
,
**
kwargs
):
from
django.conf
import
settings
warnings
=
[]
app_id
=
getattr
(
settings
,
'
GITLAB_APP_ID
'
,
None
)
app_secret
=
getattr
(
settings
,
'
GITLAB_APP_SECRET
'
,
None
)
if
not
app_id
:
warnings
.
append
(
Warning
(
'
GitLab app ID is not set; Git imports will fail.
'
,
hint
=
'
settings.GITLAB_APP_ID = {}
'
.
format
(
repr
(
app_id
)),
id
=
'
arkindex.W003
'
,
))
if
not
app_secret
:
warnings
.
append
(
Warning
(
'
GitLab app secret is not set; Git imports will fail.
'
,
hint
=
'
settings.GITLAB_APP_SECRET = {}
'
.
format
(
repr
(
app_secret
)),
id
=
'
arkindex.W004
'
,
))
return
warnings
This diff is collapsed.
Click to expand it.
arkindex/project/tests/test_checks.py
+
25
−
0
View file @
c7557127
...
...
@@ -254,3 +254,28 @@ class ChecksTestCase(TestCase):
g
=
Group
.
objects
.
create
()
settings
.
INTERNAL_GROUP_ID
=
g
.
id
self
.
assertListEqual
(
internal_group_check
(),
[])
@override_settings
()
def
test_gitlab_oauth_check
(
self
):
from
arkindex.project.checks
import
gitlab_oauth_check
del
settings
.
GITLAB_APP_ID
del
settings
.
GITLAB_APP_SECRET
self
.
assertListEqual
(
gitlab_oauth_check
(),
[
Warning
(
'
GitLab app ID is not set; Git imports will fail.
'
,
hint
=
'
settings.GITLAB_APP_ID = None
'
,
id
=
'
arkindex.W003
'
,
),
Warning
(
'
GitLab app secret is not set; Git imports will fail.
'
,
hint
=
'
settings.GITLAB_APP_SECRET = None
'
,
id
=
'
arkindex.W004
'
,
),
])
settings
.
GITLAB_APP_ID
=
'
1234
'
settings
.
GITLAB_APP_SECRET
=
'
s3kr3t
'
self
.
assertListEqual
(
gitlab_oauth_check
(),
[])
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