Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
cc5ba3d9
Commit
cc5ba3d9
authored
Oct 24, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate username/pw for Jiraservice, require them in the API
parent
82446a2b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+2
-0
changelogs/unreleased/api-configure-jira.yml
changelogs/unreleased/api-configure-jira.yml
+5
-0
lib/api/services.rb
lib/api/services.rb
+2
-2
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+14
-0
No files found.
app/models/project_services/jira_service.rb
View file @
cc5ba3d9
...
...
@@ -3,6 +3,8 @@ class JiraService < IssueTrackerService
validates
:url
,
url:
true
,
presence:
true
,
if: :activated?
validates
:api_url
,
url:
true
,
allow_blank:
true
validates
:username
,
presence:
true
,
if: :activated?
validates
:password
,
presence:
true
,
if: :activated?
prop_accessor
:username
,
:password
,
:url
,
:api_url
,
:jira_issue_transition_id
,
:title
,
:description
...
...
changelogs/unreleased/api-configure-jira.yml
0 → 100644
View file @
cc5ba3d9
---
title
:
Validate username/pw for Jiraservice, require them in the API
merge_request
:
author
:
Robert Schilling
type
:
fixed
lib/api/services.rb
View file @
cc5ba3d9
...
...
@@ -313,13 +313,13 @@ module API
desc:
'The base URL to the JIRA instance API. Web URL value will be used if not set. E.g., https://jira-api.example.com'
},
{
required:
fals
e
,
required:
tru
e
,
name: :username
,
type:
String
,
desc:
'The username of the user created to be used with GitLab/JIRA'
},
{
required:
fals
e
,
required:
tru
e
,
name: :password
,
type:
String
,
desc:
'The password of the user created to be used with GitLab/JIRA'
...
...
spec/models/project_services/jira_service_spec.rb
View file @
cc5ba3d9
...
...
@@ -24,6 +24,8 @@ describe JiraService do
end
it
{
is_expected
.
not_to
validate_presence_of
(
:url
)
}
it
{
is_expected
.
not_to
validate_presence_of
(
:username
)
}
it
{
is_expected
.
not_to
validate_presence_of
(
:password
)
}
end
context
'validating urls'
do
...
...
@@ -54,6 +56,18 @@ describe JiraService do
expect
(
service
).
not_to
be_valid
end
it
'is not valid when username is missing'
do
service
.
username
=
nil
expect
(
service
).
not_to
be_valid
end
it
'is not valid when password is missing'
do
service
.
password
=
nil
expect
(
service
).
not_to
be_valid
end
it
'is valid when api url is a valid url'
do
service
.
api_url
=
'http://jira.test.com/api'
...
...
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