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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e96401c4
Commit
e96401c4
authored
Nov 13, 2019
by
Nick Nguyen
Committed by
Ash McKenzie
Nov 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Error 500 for /api/v4/projects/ID/services/jira"
parent
9faa870e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
app/models/project_services/data_fields.rb
app/models/project_services/data_fields.rb
+1
-1
changelogs/unreleased/34770-error-500-for-api-v4-projects-id-services-jira-nomethoderror-undefi.yml
...api-v4-projects-id-services-jira-nomethoderror-undefi.yml
+5
-0
spec/models/project_services/data_fields_spec.rb
spec/models/project_services/data_fields_spec.rb
+18
-0
spec/requests/api/services_spec.rb
spec/requests/api/services_spec.rb
+2
-2
No files found.
app/models/project_services/data_fields.rb
View file @
e96401c4
...
...
@@ -50,7 +50,7 @@ module DataFields
end
def
data_fields_present?
data_fields
.
p
ersisted
?
data_fields
.
p
resent
?
rescue
NotImplementedError
false
end
...
...
changelogs/unreleased/34770-error-500-for-api-v4-projects-id-services-jira-nomethoderror-undefi.yml
0 → 100644
View file @
e96401c4
---
title
:
Fix project service API 500 error
merge_request
:
19367
author
:
type
:
fixed
spec/models/project_services/data_fields_spec.rb
View file @
e96401c4
...
...
@@ -74,6 +74,12 @@ describe DataFields do
expect
(
service
.
url_changed?
).
to
be_falsy
end
end
describe
'data_fields_present?'
do
it
'returns true from the issue tracker service'
do
expect
(
service
.
data_fields_present?
).
to
be
true
end
end
end
context
'when data are stored in data_fields'
do
...
...
@@ -92,6 +98,18 @@ describe DataFields do
end
end
context
'when service and data_fields are not persisted'
do
let
(
:service
)
do
JiraService
.
new
end
describe
'data_fields_present?'
do
it
'returns true'
do
expect
(
service
.
data_fields_present?
).
to
be
true
end
end
end
context
'when data are stored in properties'
do
let
(
:service
)
{
create
(
:jira_service
,
:without_properties_callback
,
properties:
properties
)
}
...
...
spec/requests/api/services_spec.rb
View file @
e96401c4
...
...
@@ -102,7 +102,7 @@ describe API::Services do
expect
(
json_response
[
'properties'
].
keys
).
to
match_array
(
service_instance
.
api_field_names
)
end
it
"returns empty hash if properties and data fields are empty"
do
it
"returns empty hash
or nil values
if properties and data fields are empty"
do
# deprecated services are not valid for update
initialized_service
.
update_attribute
(
:properties
,
{})
...
...
@@ -114,7 +114,7 @@ describe API::Services do
get
api
(
"/projects/
#{
project
.
id
}
/services/
#{
dashed_service
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'properties'
].
keys
).
to
be_empty
expect
(
json_response
[
'properties'
].
values
.
compact
).
to
be_empty
end
it
"returns error when authenticated but not a project owner"
do
...
...
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