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
1d6bb047
Commit
1d6bb047
authored
Feb 13, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add http status cop to subfolders of api specs
243 files inspected, 232 offenses detected, 232 offenses corrected
parent
22f6af08
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
239 additions
and
237 deletions
+239
-237
.rubocop.yml
.rubocop.yml
+2
-0
ee/spec/requests/api/graphql/group/epics_spec.rb
ee/spec/requests/api/graphql/group/epics_spec.rb
+1
-1
ee/spec/requests/api/graphql/group/timelogs_spec.rb
ee/spec/requests/api/graphql/group/timelogs_spec.rb
+1
-1
ee/spec/requests/api/graphql/group_query_spec.rb
ee/spec/requests/api/graphql/group_query_spec.rb
+2
-2
ee/spec/requests/api/internal/base_spec.rb
ee/spec/requests/api/internal/base_spec.rb
+13
-13
ee/spec/requests/api/v3/github_spec.rb
ee/spec/requests/api/v3/github_spec.rb
+36
-36
spec/requests/api/graphql/group/milestones_spec.rb
spec/requests/api/graphql/group/milestones_spec.rb
+1
-1
spec/requests/api/graphql/group_query_spec.rb
spec/requests/api/graphql/group_query_spec.rb
+1
-1
spec/requests/api/graphql/tasks/task_completion_status_spec.rb
...requests/api/graphql/tasks/task_completion_status_spec.rb
+1
-1
spec/requests/api/internal/base_spec.rb
spec/requests/api/internal/base_spec.rb
+47
-47
spec/requests/api/internal/pages_spec.rb
spec/requests/api/internal/pages_spec.rb
+7
-7
spec/requests/api/issues/get_group_issues_spec.rb
spec/requests/api/issues/get_group_issues_spec.rb
+5
-5
spec/requests/api/issues/get_project_issues_spec.rb
spec/requests/api/issues/get_project_issues_spec.rb
+26
-26
spec/requests/api/issues/issues_spec.rb
spec/requests/api/issues/issues_spec.rb
+23
-23
spec/requests/api/issues/post_projects_issues_spec.rb
spec/requests/api/issues/post_projects_issues_spec.rb
+42
-42
spec/requests/api/issues/put_projects_issues_spec.rb
spec/requests/api/issues/put_projects_issues_spec.rb
+28
-28
spec/requests/api/pages/pages_spec.rb
spec/requests/api/pages/pages_spec.rb
+3
-3
No files found.
.rubocop.yml
View file @
1d6bb047
...
@@ -345,6 +345,8 @@ RSpec/HaveGitlabHttpStatus:
...
@@ -345,6 +345,8 @@ RSpec/HaveGitlabHttpStatus:
-
'
ee/spec/controllers/**/*'
-
'
ee/spec/controllers/**/*'
-
'
spec/requests/*.rb'
-
'
spec/requests/*.rb'
-
'
ee/spec/requests/*.rb'
-
'
ee/spec/requests/*.rb'
-
'
spec/requests/api/*/**/*.rb'
-
'
ee/spec/requests/api/*/**/*.rb'
Style/MultilineWhenThen
:
Style/MultilineWhenThen
:
Enabled
:
false
Enabled
:
false
...
...
ee/spec/requests/api/graphql/group/epics_spec.rb
View file @
1d6bb047
...
@@ -50,7 +50,7 @@ describe 'Epics through GroupQuery' do
...
@@ -50,7 +50,7 @@ describe 'Epics through GroupQuery' do
it_behaves_like
'a working graphql query'
it_behaves_like
'a working graphql query'
it
'returns epics successfully'
do
it
'returns epics successfully'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
graphql_errors
).
to
be_nil
expect
(
graphql_errors
).
to
be_nil
expect
(
epic_node_array
(
'id'
).
first
).
to
eq
epic
.
to_global_id
.
to_s
expect
(
epic_node_array
(
'id'
).
first
).
to
eq
epic
.
to_global_id
.
to_s
expect
(
graphql_data
[
'group'
][
'epicsEnabled'
]).
to
be_truthy
expect
(
graphql_data
[
'group'
][
'epicsEnabled'
]).
to
be_truthy
...
...
ee/spec/requests/api/graphql/group/timelogs_spec.rb
View file @
1d6bb047
...
@@ -59,7 +59,7 @@ describe 'Timelogs through GroupQuery' do
...
@@ -59,7 +59,7 @@ describe 'Timelogs through GroupQuery' do
it_behaves_like
'a working graphql query'
it_behaves_like
'a working graphql query'
it
'returns timelogs successfully'
do
it
'returns timelogs successfully'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
graphql_errors
).
to
be_nil
expect
(
graphql_errors
).
to
be_nil
expect
(
node_array
.
size
).
to
eq
1
expect
(
node_array
.
size
).
to
eq
1
expect
(
graphql_data
[
'group'
][
'groupTimelogsEnabled'
]).
to
be_truthy
expect
(
graphql_data
[
'group'
][
'groupTimelogsEnabled'
]).
to
be_truthy
...
...
ee/spec/requests/api/graphql/group_query_spec.rb
View file @
1d6bb047
...
@@ -31,7 +31,7 @@ describe 'getting group information' do
...
@@ -31,7 +31,7 @@ describe 'getting group information' do
it
'allows access via session'
do
it
'allows access via session'
do
post_graphql
(
group_query
(
group
),
current_user:
user
)
post_graphql
(
group_query
(
group
),
current_user:
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
graphql_data
[
'group'
][
'id'
]).
to
eq
(
group
.
to_global_id
.
to_s
)
expect
(
graphql_data
[
'group'
][
'id'
]).
to
eq
(
group
.
to_global_id
.
to_s
)
end
end
...
@@ -39,7 +39,7 @@ describe 'getting group information' do
...
@@ -39,7 +39,7 @@ describe 'getting group information' do
token
=
create
(
:personal_access_token
,
user:
user
).
token
token
=
create
(
:personal_access_token
,
user:
user
).
token
post_graphql
(
group_query
(
group
),
headers:
{
'Authorization'
=>
"Bearer
#{
token
}
"
})
post_graphql
(
group_query
(
group
),
headers:
{
'Authorization'
=>
"Bearer
#{
token
}
"
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
graphql_data
[
'group'
][
'id'
]).
to
eq
(
group
.
to_global_id
.
to_s
)
expect
(
graphql_data
[
'group'
][
'id'
]).
to
eq
(
group
.
to_global_id
.
to_s
)
end
end
end
end
...
...
ee/spec/requests/api/internal/base_spec.rb
View file @
1d6bb047
...
@@ -55,7 +55,7 @@ describe API::Internal::Base do
...
@@ -55,7 +55,7 @@ describe API::Internal::Base do
it
'includes current Geo secondary lag in the output'
do
it
'includes current Geo secondary lag in the output'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
to
include
({
expect
(
json_response
[
'messages'
]).
to
include
({
'type'
=>
'basic'
,
'type'
=>
'basic'
,
'message'
=>
"Current replication lag: 17 seconds"
'message'
=>
"Current replication lag: 17 seconds"
...
@@ -69,7 +69,7 @@ describe API::Internal::Base do
...
@@ -69,7 +69,7 @@ describe API::Internal::Base do
it
'does not include current Geo secondary lag in the output'
do
it
'does not include current Geo secondary lag in the output'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
end
end
end
end
...
@@ -80,7 +80,7 @@ describe API::Internal::Base do
...
@@ -80,7 +80,7 @@ describe API::Internal::Base do
it
'does not include current Geo secondary lag in the output'
do
it
'does not include current Geo secondary lag in the output'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
end
end
end
end
...
@@ -90,7 +90,7 @@ describe API::Internal::Base do
...
@@ -90,7 +90,7 @@ describe API::Internal::Base do
it
'does not include current Geo secondary lag in the output'
do
it
'does not include current Geo secondary lag in the output'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
end
end
end
end
...
@@ -105,7 +105,7 @@ describe API::Internal::Base do
...
@@ -105,7 +105,7 @@ describe API::Internal::Base do
it
'does not include current Geo secondary lag in the output'
do
it
'does not include current Geo secondary lag in the output'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
expect
(
json_response
[
'messages'
]).
not_to
include
({
'message'
=>
a_string_matching
(
'replication lag'
),
'type'
=>
anything
})
end
end
end
end
...
@@ -130,7 +130,7 @@ describe API::Internal::Base do
...
@@ -130,7 +130,7 @@ describe API::Internal::Base do
protocol:
'ssh'
protocol:
'ssh'
})
})
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
...
@@ -158,7 +158,7 @@ describe API::Internal::Base do
...
@@ -158,7 +158,7 @@ describe API::Internal::Base do
end
end
it
"does not allow access because project can't be found"
do
it
"does not allow access because project can't be found"
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -174,7 +174,7 @@ describe API::Internal::Base do
...
@@ -174,7 +174,7 @@ describe API::Internal::Base do
end
end
it
"allows access"
do
it
"allows access"
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -184,7 +184,7 @@ describe API::Internal::Base do
...
@@ -184,7 +184,7 @@ describe API::Internal::Base do
end
end
it
"does not allow access because project can't be found"
do
it
"does not allow access because project can't be found"
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -227,7 +227,7 @@ describe API::Internal::Base do
...
@@ -227,7 +227,7 @@ describe API::Internal::Base do
it
"allows access"
do
it
"allows access"
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -235,7 +235,7 @@ describe API::Internal::Base do
...
@@ -235,7 +235,7 @@ describe API::Internal::Base do
it
"does not allow access"
do
it
"does not allow access"
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
json_response
[
'message'
]).
to
eql
(
'Project requires smartcard login. Please login to GitLab using a smartcard.'
)
expect
(
json_response
[
'message'
]).
to
eql
(
'Project requires smartcard login. Please login to GitLab using a smartcard.'
)
end
end
end
end
...
@@ -248,7 +248,7 @@ describe API::Internal::Base do
...
@@ -248,7 +248,7 @@ describe API::Internal::Base do
it
"allows access"
do
it
"allows access"
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
end
end
...
@@ -318,7 +318,7 @@ describe API::Internal::Base do
...
@@ -318,7 +318,7 @@ describe API::Internal::Base do
lfs_auth_user
(
user
.
id
,
project
)
lfs_auth_user
(
user
.
id
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
geo_primary_http_url_to_repo
(
project
))
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
geo_primary_http_url_to_repo
(
project
))
end
end
end
end
...
...
ee/spec/requests/api/v3/github_spec.rb
View file @
1d6bb047
...
@@ -19,7 +19,7 @@ describe API::V3::Github do
...
@@ -19,7 +19,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/orgs/
#{
group
.
path
}
/repos"
,
user
)
jira_get
v3_api
(
"/orgs/
#{
group
.
path
}
/repos"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
).
to
eq
([])
end
end
...
@@ -28,7 +28,7 @@ describe API::V3::Github do
...
@@ -28,7 +28,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/orgs/
#{
group
.
path
}
/repos"
,
user
)
jira_get
v3_api
(
"/orgs/
#{
group
.
path
}
/repos"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -36,7 +36,7 @@ describe API::V3::Github do
...
@@ -36,7 +36,7 @@ describe API::V3::Github do
it
'returns an empty array'
do
it
'returns an empty array'
do
jira_get
v3_api
(
'/user/repos'
,
user
)
jira_get
v3_api
(
'/user/repos'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
).
to
eq
([])
end
end
end
end
...
@@ -54,7 +54,7 @@ describe API::V3::Github do
...
@@ -54,7 +54,7 @@ describe API::V3::Github do
it
'returns an array of notes'
do
it
'returns an array of notes'
do
jira_get
v3_api
(
"/repos/
#{
path
}
/issues/
#{
merge_request
.
id
}
/comments"
,
user
)
jira_get
v3_api
(
"/repos/
#{
path
}
/issues/
#{
merge_request
.
id
}
/comments"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
size
).
to
eq
(
1
)
end
end
...
@@ -70,7 +70,7 @@ describe API::V3::Github do
...
@@ -70,7 +70,7 @@ describe API::V3::Github do
it
'returns 404'
do
it
'returns 404'
do
jira_get
v3_api
(
"/repos/
#{
path
}
/issues/
#{
merge_request
.
id
}
/comments"
,
user
)
jira_get
v3_api
(
"/repos/
#{
path
}
/issues/
#{
merge_request
.
id
}
/comments"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -79,7 +79,7 @@ describe API::V3::Github do
...
@@ -79,7 +79,7 @@ describe API::V3::Github do
it
'returns an empty array'
do
it
'returns an empty array'
do
jira_get
v3_api
(
"/repos/
#{
path
}
/pulls/xpto/commits"
,
user
)
jira_get
v3_api
(
"/repos/
#{
path
}
/pulls/xpto/commits"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
).
to
eq
([])
end
end
end
end
...
@@ -88,7 +88,7 @@ describe API::V3::Github do
...
@@ -88,7 +88,7 @@ describe API::V3::Github do
it
'returns an empty array'
do
it
'returns an empty array'
do
jira_get
v3_api
(
"/repos/
#{
path
}
/pulls/xpto/comments"
,
user
)
jira_get
v3_api
(
"/repos/
#{
path
}
/pulls/xpto/comments"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
).
to
eq
([])
end
end
end
end
...
@@ -104,7 +104,7 @@ describe API::V3::Github do
...
@@ -104,7 +104,7 @@ describe API::V3::Github do
it
'returns an empty Array for events'
do
it
'returns an empty Array for events'
do
jira_get
v3_api
(
'/repos/-/jira/events'
,
user
)
jira_get
v3_api
(
'/repos/-/jira/events'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
).
to
eq
([])
end
end
end
end
...
@@ -121,7 +121,7 @@ describe API::V3::Github do
...
@@ -121,7 +121,7 @@ describe API::V3::Github do
it
'responds with the expected user'
do
it
'responds with the expected user'
do
jira_get
v3_api
(
"/users/
#{
user
.
username
}
"
,
user
)
jira_get
v3_api
(
"/users/
#{
user
.
username
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'entities/github/user'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/user'
,
dir:
'ee'
)
end
end
end
end
...
@@ -130,7 +130,7 @@ describe API::V3::Github do
...
@@ -130,7 +130,7 @@ describe API::V3::Github do
it
'responds with the expected status'
do
it
'responds with the expected status'
do
jira_get
v3_api
(
'/users/unknown_user_name'
,
user
)
jira_get
v3_api
(
'/users/unknown_user_name'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -143,7 +143,7 @@ describe API::V3::Github do
...
@@ -143,7 +143,7 @@ describe API::V3::Github do
it
'responds with forbidden'
do
it
'responds with forbidden'
do
jira_get
v3_api
(
"/users/
#{
user
.
username
}
"
,
unauthorized_user
)
jira_get
v3_api
(
"/users/
#{
user
.
username
}
"
,
unauthorized_user
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
end
end
...
@@ -157,7 +157,7 @@ describe API::V3::Github do
...
@@ -157,7 +157,7 @@ describe API::V3::Github do
it
'returns an empty array'
do
it
'returns an empty array'
do
jira_get
v3_api
(
events_path
,
user
)
jira_get
v3_api
(
events_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
).
to
eq
([])
end
end
end
end
...
@@ -168,7 +168,7 @@ describe API::V3::Github do
...
@@ -168,7 +168,7 @@ describe API::V3::Github do
it
'returns an event'
do
it
'returns an event'
do
jira_get
v3_api
(
events_path
,
user
)
jira_get
v3_api
(
events_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
size
).
to
eq
(
1
)
end
end
...
@@ -181,7 +181,7 @@ describe API::V3::Github do
...
@@ -181,7 +181,7 @@ describe API::V3::Github do
it
'returns the expected amount of events'
do
it
'returns the expected amount of events'
do
jira_get
v3_api
(
events_path
,
user
)
jira_get
v3_api
(
events_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
json_response
.
size
).
to
eq
(
2
)
end
end
...
@@ -215,7 +215,7 @@ describe API::V3::Github do
...
@@ -215,7 +215,7 @@ describe API::V3::Github do
it
'returns an array of merge requests with github format'
do
it
'returns an array of merge requests with github format'
do
jira_get
v3_api
(
'/repos/-/jira/pulls'
,
user
)
jira_get
v3_api
(
'/repos/-/jira/pulls'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_requests'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_requests'
,
dir:
'ee'
)
...
@@ -226,7 +226,7 @@ describe API::V3::Github do
...
@@ -226,7 +226,7 @@ describe API::V3::Github do
it
'returns an array of merge requests for the proper project in github format'
do
it
'returns an array of merge requests for the proper project in github format'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls"
,
user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_requests'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_requests'
,
dir:
'ee'
)
...
@@ -238,7 +238,7 @@ describe API::V3::Github do
...
@@ -238,7 +238,7 @@ describe API::V3::Github do
it
'returns the requested merge request in github format'
do
it
'returns the requested merge request in github format'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls/
#{
merge_request
.
id
}
"
,
user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls/
#{
merge_request
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_request'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_request'
,
dir:
'ee'
)
end
end
end
end
...
@@ -249,7 +249,7 @@ describe API::V3::Github do
...
@@ -249,7 +249,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls/
#{
merge_request
.
id
}
"
,
unauthorized_user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls/
#{
merge_request
.
id
}
"
,
unauthorized_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -257,7 +257,7 @@ describe API::V3::Github do
...
@@ -257,7 +257,7 @@ describe API::V3::Github do
it
'returns the requested merge request in github format'
do
it
'returns the requested merge request in github format'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls/
#{
merge_request
.
id
}
"
,
admin
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/pulls/
#{
merge_request
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_request'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/pull_request'
,
dir:
'ee'
)
end
end
end
end
...
@@ -270,7 +270,7 @@ describe API::V3::Github do
...
@@ -270,7 +270,7 @@ describe API::V3::Github do
def
expect_project_under_namespace
(
projects
,
namespace
,
user
)
def
expect_project_under_namespace
(
projects
,
namespace
,
user
)
jira_get
v3_api
(
"/users/
#{
namespace
.
path
}
/repos"
,
user
)
jira_get
v3_api
(
"/users/
#{
namespace
.
path
}
/repos"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
match_response_schema
(
'entities/github/repositories'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/repositories'
,
dir:
'ee'
)
...
@@ -325,7 +325,7 @@ describe API::V3::Github do
...
@@ -325,7 +325,7 @@ describe API::V3::Github do
it
'returns not found'
do
it
'returns not found'
do
jira_get
v3_api
(
"/users/
#{
group
.
parent
.
path
}
/repos"
,
user
)
jira_get
v3_api
(
"/users/
#{
group
.
parent
.
path
}
/repos"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -343,7 +343,7 @@ describe API::V3::Github do
...
@@ -343,7 +343,7 @@ describe API::V3::Github do
create
(
:project
,
:repository
,
group:
new_group
,
creator:
user
)
create
(
:project
,
:repository
,
group:
new_group
,
creator:
user
)
expect
{
jira_get
v3_api
(
"/users/
#{
group
.
parent
.
path
}
/repos"
,
user
)
}.
not_to
exceed_query_limit
(
control
)
expect
{
jira_get
v3_api
(
"/users/
#{
group
.
parent
.
path
}
/repos"
,
user
)
}.
not_to
exceed_query_limit
(
control
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
end
end
...
@@ -374,7 +374,7 @@ describe API::V3::Github do
...
@@ -374,7 +374,7 @@ describe API::V3::Github do
it
'returns 401'
do
it
'returns 401'
do
jira_get
v3_api
(
'/users/foo/repos'
,
nil
)
jira_get
v3_api
(
'/users/foo/repos'
,
nil
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
...
@@ -394,7 +394,7 @@ describe API::V3::Github do
...
@@ -394,7 +394,7 @@ describe API::V3::Github do
it
'responds with not found status'
do
it
'responds with not found status'
do
jira_get
v3_api
(
'/users/noo/repos'
,
user
)
jira_get
v3_api
(
'/users/noo/repos'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -426,7 +426,7 @@ describe API::V3::Github do
...
@@ -426,7 +426,7 @@ describe API::V3::Github do
it
'returns an array of project branches with github format'
do
it
'returns an array of project branches with github format'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
...
@@ -438,7 +438,7 @@ describe API::V3::Github do
...
@@ -438,7 +438,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'returns 200 when namespace path include a dot'
do
it
'returns 200 when namespace path include a dot'
do
...
@@ -448,7 +448,7 @@ describe API::V3::Github do
...
@@ -448,7 +448,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
group
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
jira_get
v3_api
(
"/repos/
#{
group
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -456,7 +456,7 @@ describe API::V3::Github do
...
@@ -456,7 +456,7 @@ describe API::V3::Github do
it
'returns 401'
do
it
'returns 401'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
nil
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
nil
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
...
@@ -466,7 +466,7 @@ describe API::V3::Github do
...
@@ -466,7 +466,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
unauthorized_user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
unauthorized_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 when not licensed'
do
it
'returns 404 when not licensed'
do
...
@@ -475,7 +475,7 @@ describe API::V3::Github do
...
@@ -475,7 +475,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
unauthorized_user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
unauthorized_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -488,7 +488,7 @@ describe API::V3::Github do
...
@@ -488,7 +488,7 @@ describe API::V3::Github do
it
'returns commit with github format'
do
it
'returns commit with github format'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'entities/github/commit'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/commit'
,
dir:
'ee'
)
end
end
...
@@ -497,7 +497,7 @@ describe API::V3::Github do
...
@@ -497,7 +497,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'returns 200 when namespace path include a dot'
do
it
'returns 200 when namespace path include a dot'
do
...
@@ -507,7 +507,7 @@ describe API::V3::Github do
...
@@ -507,7 +507,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
group
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
jira_get
v3_api
(
"/repos/
#{
group
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -515,7 +515,7 @@ describe API::V3::Github do
...
@@ -515,7 +515,7 @@ describe API::V3::Github do
it
'returns 401'
do
it
'returns 401'
do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
nil
)
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
nil
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
...
@@ -526,7 +526,7 @@ describe API::V3::Github do
...
@@ -526,7 +526,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
unauthorized_user
)
unauthorized_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 when not licensed'
do
it
'returns 404 when not licensed'
do
...
@@ -536,7 +536,7 @@ describe API::V3::Github do
...
@@ -536,7 +536,7 @@ describe API::V3::Github do
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
jira_get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
unauthorized_user
)
unauthorized_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
...
spec/requests/api/graphql/group/milestones_spec.rb
View file @
1d6bb047
...
@@ -29,7 +29,7 @@ describe 'Milestones through GroupQuery' do
...
@@ -29,7 +29,7 @@ describe 'Milestones through GroupQuery' do
it_behaves_like
'a working graphql query'
it_behaves_like
'a working graphql query'
it
'returns milestones successfully'
do
it
'returns milestones successfully'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
graphql_errors
).
to
be_nil
expect
(
graphql_errors
).
to
be_nil
expect_array_response
(
milestone_1
.
to_global_id
.
to_s
,
milestone_2
.
to_global_id
.
to_s
,
milestone_3
.
to_global_id
.
to_s
,
milestone_4
.
to_global_id
.
to_s
)
expect_array_response
(
milestone_1
.
to_global_id
.
to_s
,
milestone_2
.
to_global_id
.
to_s
,
milestone_3
.
to_global_id
.
to_s
,
milestone_4
.
to_global_id
.
to_s
)
end
end
...
...
spec/requests/api/graphql/group_query_spec.rb
View file @
1d6bb047
...
@@ -55,7 +55,7 @@ describe 'getting group information' do
...
@@ -55,7 +55,7 @@ describe 'getting group information' do
post_graphql
(
group_query
(
group1
),
current_user:
user1
)
post_graphql
(
group_query
(
group1
),
current_user:
user1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
graphql_data
[
'group'
][
'id'
]).
to
eq
(
group1
.
to_global_id
.
to_s
)
expect
(
graphql_data
[
'group'
][
'id'
]).
to
eq
(
group1
.
to_global_id
.
to_s
)
expect
(
graphql_data
[
'group'
][
'name'
]).
to
eq
(
group1
.
name
)
expect
(
graphql_data
[
'group'
][
'name'
]).
to
eq
(
group1
.
name
)
expect
(
graphql_data
[
'group'
][
'path'
]).
to
eq
(
group1
.
path
)
expect
(
graphql_data
[
'group'
][
'path'
]).
to
eq
(
group1
.
path
)
...
...
spec/requests/api/graphql/tasks/task_completion_status_spec.rb
View file @
1d6bb047
...
@@ -33,7 +33,7 @@ describe 'getting task completion status information' do
...
@@ -33,7 +33,7 @@ describe 'getting task completion status information' do
it
'returns the expected task completion status'
do
it
'returns the expected task completion status'
do
post_graphql
(
create_task_completion_status_query_for
(
type
,
item
.
iid
),
current_user:
user1
)
post_graphql
(
create_task_completion_status_query_for
(
type
,
item
.
iid
),
current_user:
user1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
task_completion_status
=
graphql_data
.
dig
(
'project'
,
type
,
'taskCompletionStatus'
)
task_completion_status
=
graphql_data
.
dig
(
'project'
,
type
,
'taskCompletionStatus'
)
expect
(
task_completion_status
).
not_to
be_nil
expect
(
task_completion_status
).
not_to
be_nil
...
...
spec/requests/api/internal/base_spec.rb
View file @
1d6bb047
...
@@ -16,7 +16,7 @@ describe API::Internal::Base do
...
@@ -16,7 +16,7 @@ describe API::Internal::Base do
get
api
(
"/internal/check"
),
params:
{
secret_token:
secret_token
}
get
api
(
"/internal/check"
),
params:
{
secret_token:
secret_token
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'api_version'
]).
to
eq
(
API
::
API
.
version
)
expect
(
json_response
[
'api_version'
]).
to
eq
(
API
::
API
.
version
)
expect
(
json_response
[
'redis'
]).
to
be
(
true
)
expect
(
json_response
[
'redis'
]).
to
be
(
true
)
end
end
...
@@ -34,13 +34,13 @@ describe API::Internal::Base do
...
@@ -34,13 +34,13 @@ describe API::Internal::Base do
get
api
(
"/internal/check"
),
get
api
(
"/internal/check"
),
headers:
{
API
::
Helpers
::
GITLAB_SHARED_SECRET_HEADER
=>
Base64
.
encode64
(
secret_token
)
}
headers:
{
API
::
Helpers
::
GITLAB_SHARED_SECRET_HEADER
=>
Base64
.
encode64
(
secret_token
)
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'returns 401 when no credentials provided'
do
it
'returns 401 when no credentials provided'
do
get
(
api
(
"/internal/check"
))
get
(
api
(
"/internal/check"
))
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
end
end
...
@@ -126,7 +126,7 @@ describe API::Internal::Base do
...
@@ -126,7 +126,7 @@ describe API::Internal::Base do
it
'returns the correct information about the key'
do
it
'returns the correct information about the key'
do
lfs_auth_key
(
key
.
id
,
project
)
lfs_auth_key
(
key
.
id
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
json_response
[
'expires_in'
]).
to
eq
(
Gitlab
::
LfsToken
::
DEFAULT_EXPIRE_TIME
)
expect
(
json_response
[
'expires_in'
]).
to
eq
(
Gitlab
::
LfsToken
::
DEFAULT_EXPIRE_TIME
)
...
@@ -136,7 +136,7 @@ describe API::Internal::Base do
...
@@ -136,7 +136,7 @@ describe API::Internal::Base do
it
'returns the correct information about the user'
do
it
'returns the correct information about the user'
do
lfs_auth_user
(
user
.
id
,
project
)
lfs_auth_user
(
user
.
id
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
Gitlab
::
LfsToken
.
new
(
user
).
token_valid?
(
json_response
[
'lfs_token'
])).
to
be_truthy
expect
(
Gitlab
::
LfsToken
.
new
(
user
).
token_valid?
(
json_response
[
'lfs_token'
])).
to
be_truthy
...
@@ -145,19 +145,19 @@ describe API::Internal::Base do
...
@@ -145,19 +145,19 @@ describe API::Internal::Base do
it
'returns a 404 when no key or user is provided'
do
it
'returns a 404 when no key or user is provided'
do
lfs_auth_project
(
project
)
lfs_auth_project
(
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns a 404 when the wrong key is provided'
do
it
'returns a 404 when the wrong key is provided'
do
lfs_auth_key
(
key
.
id
+
12345
,
project
)
lfs_auth_key
(
key
.
id
+
12345
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns a 404 when the wrong user is provided'
do
it
'returns a 404 when the wrong user is provided'
do
lfs_auth_user
(
user
.
id
+
12345
,
project
)
lfs_auth_user
(
user
.
id
+
12345
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -167,7 +167,7 @@ describe API::Internal::Base do
...
@@ -167,7 +167,7 @@ describe API::Internal::Base do
it
'returns the correct information about the key'
do
it
'returns the correct information about the key'
do
lfs_auth_key
(
key
.
id
,
project
)
lfs_auth_key
(
key
.
id
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'username'
]).
to
eq
(
"lfs+deploy-key-
#{
key
.
id
}
"
)
expect
(
json_response
[
'username'
]).
to
eq
(
"lfs+deploy-key-
#{
key
.
id
}
"
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
json_response
[
'repository_http_path'
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
Gitlab
::
LfsToken
.
new
(
key
).
token_valid?
(
json_response
[
'lfs_token'
])).
to
be_truthy
expect
(
Gitlab
::
LfsToken
.
new
(
key
).
token_valid?
(
json_response
[
'lfs_token'
])).
to
be_truthy
...
@@ -179,7 +179,7 @@ describe API::Internal::Base do
...
@@ -179,7 +179,7 @@ describe API::Internal::Base do
it
"finds a user by key id"
do
it
"finds a user by key id"
do
get
(
api
(
"/internal/discover"
),
params:
{
key_id:
key
.
id
,
secret_token:
secret_token
})
get
(
api
(
"/internal/discover"
),
params:
{
key_id:
key
.
id
,
secret_token:
secret_token
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'name'
]).
to
eq
(
user
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
user
.
name
)
end
end
...
@@ -187,7 +187,7 @@ describe API::Internal::Base do
...
@@ -187,7 +187,7 @@ describe API::Internal::Base do
it
"finds a user by username"
do
it
"finds a user by username"
do
get
(
api
(
"/internal/discover"
),
params:
{
username:
user
.
username
,
secret_token:
secret_token
})
get
(
api
(
"/internal/discover"
),
params:
{
username:
user
.
username
,
secret_token:
secret_token
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'name'
]).
to
eq
(
user
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
user
.
name
)
end
end
...
@@ -195,7 +195,7 @@ describe API::Internal::Base do
...
@@ -195,7 +195,7 @@ describe API::Internal::Base do
it
'responds successfully when a user is not found'
do
it
'responds successfully when a user is not found'
do
get
(
api
(
'/internal/discover'
),
params:
{
username:
'noone'
,
secret_token:
secret_token
})
get
(
api
(
'/internal/discover'
),
params:
{
username:
'noone'
,
secret_token:
secret_token
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
eq
(
'null'
)
expect
(
response
.
body
).
to
eq
(
'null'
)
end
end
...
@@ -203,7 +203,7 @@ describe API::Internal::Base do
...
@@ -203,7 +203,7 @@ describe API::Internal::Base do
it
'response successfully when passing invalid params'
do
it
'response successfully when passing invalid params'
do
get
(
api
(
'/internal/discover'
),
params:
{
nothing:
'to find a user'
,
secret_token:
secret_token
})
get
(
api
(
'/internal/discover'
),
params:
{
nothing:
'to find a user'
,
secret_token:
secret_token
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
eq
(
'null'
)
expect
(
response
.
body
).
to
eq
(
'null'
)
end
end
...
@@ -284,7 +284,7 @@ describe API::Internal::Base do
...
@@ -284,7 +284,7 @@ describe API::Internal::Base do
GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE
:
alt_obj_dirs_relative
GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE
:
alt_obj_dirs_relative
}.
to_json
)
}.
to_json
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -292,7 +292,7 @@ describe API::Internal::Base do
...
@@ -292,7 +292,7 @@ describe API::Internal::Base do
it
'responds with success'
do
it
'responds with success'
do
push
(
key
,
project
.
wiki
)
push
(
key
,
project
.
wiki
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
wiki
.
full_path
)
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
wiki
.
full_path
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"wiki-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"wiki-
#{
project
.
id
}
"
)
...
@@ -304,7 +304,7 @@ describe API::Internal::Base do
...
@@ -304,7 +304,7 @@ describe API::Internal::Base do
it
'responds with success'
do
it
'responds with success'
do
pull
(
key
,
project
.
wiki
)
pull
(
key
,
project
.
wiki
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
wiki
.
full_path
)
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
wiki
.
full_path
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"wiki-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"wiki-
#{
project
.
id
}
"
)
...
@@ -320,7 +320,7 @@ describe API::Internal::Base do
...
@@ -320,7 +320,7 @@ describe API::Internal::Base do
it
"has the correct payload"
do
it
"has the correct payload"
do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
full_path
)
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
full_path
)
...
@@ -340,7 +340,7 @@ describe API::Internal::Base do
...
@@ -340,7 +340,7 @@ describe API::Internal::Base do
it
do
it
do
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_repository"
]).
to
eq
(
"project-
#{
project
.
id
}
"
)
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
full_path
)
expect
(
json_response
[
"gl_project_path"
]).
to
eq
(
project
.
full_path
)
...
@@ -409,7 +409,7 @@ describe API::Internal::Base do
...
@@ -409,7 +409,7 @@ describe API::Internal::Base do
it
do
it
do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
end
end
...
@@ -419,7 +419,7 @@ describe API::Internal::Base do
...
@@ -419,7 +419,7 @@ describe API::Internal::Base do
it
do
it
do
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
end
end
...
@@ -464,7 +464,7 @@ describe API::Internal::Base do
...
@@ -464,7 +464,7 @@ describe API::Internal::Base do
it
do
it
do
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
300
)
expect
(
response
).
to
have_gitlab_http_status
(
:multiple_choices
)
expect
(
json_response
[
'status'
]).
to
be_truthy
expect
(
json_response
[
'status'
]).
to
be_truthy
expect
(
json_response
[
'payload'
]).
to
eql
(
payload
)
expect
(
json_response
[
'payload'
]).
to
eql
(
payload
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eql
(
console_messages
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eql
(
console_messages
)
...
@@ -483,7 +483,7 @@ describe API::Internal::Base do
...
@@ -483,7 +483,7 @@ describe API::Internal::Base do
it
"has the correct payload"
do
it
"has the correct payload"
do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eq
([])
expect
(
json_response
[
'gl_console_messages'
]).
to
eq
([])
end
end
end
end
...
@@ -500,7 +500,7 @@ describe API::Internal::Base do
...
@@ -500,7 +500,7 @@ describe API::Internal::Base do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eq
(
console_messages
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eq
(
console_messages
)
end
end
end
end
...
@@ -518,7 +518,7 @@ describe API::Internal::Base do
...
@@ -518,7 +518,7 @@ describe API::Internal::Base do
it
do
it
do
pull
(
key
,
personal_project
)
pull
(
key
,
personal_project
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
end
end
...
@@ -528,7 +528,7 @@ describe API::Internal::Base do
...
@@ -528,7 +528,7 @@ describe API::Internal::Base do
it
do
it
do
push
(
key
,
personal_project
)
push
(
key
,
personal_project
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
end
end
...
@@ -545,7 +545,7 @@ describe API::Internal::Base do
...
@@ -545,7 +545,7 @@ describe API::Internal::Base do
end
end
push
(
key
,
personal_project
)
push
(
key
,
personal_project
)
expect
(
response
).
to
have_gitlab_http_status
(
503
)
expect
(
response
).
to
have_gitlab_http_status
(
:service_unavailable
)
expect
(
json_response
[
'status'
]).
to
be_falsey
expect
(
json_response
[
'status'
]).
to
be_falsey
expect
(
json_response
[
'message'
]).
to
eq
(
"Foo"
)
expect
(
json_response
[
'message'
]).
to
eq
(
"Foo"
)
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
expect
(
user
.
reload
.
last_activity_on
).
to
be_nil
...
@@ -563,7 +563,7 @@ describe API::Internal::Base do
...
@@ -563,7 +563,7 @@ describe API::Internal::Base do
it
do
it
do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
end
end
end
end
...
@@ -572,7 +572,7 @@ describe API::Internal::Base do
...
@@ -572,7 +572,7 @@ describe API::Internal::Base do
it
do
it
do
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
end
end
end
end
...
@@ -589,7 +589,7 @@ describe API::Internal::Base do
...
@@ -589,7 +589,7 @@ describe API::Internal::Base do
it
do
it
do
archive
(
key
,
project
)
archive
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"gitaly"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
][
"repository"
]).
not_to
be_nil
expect
(
json_response
[
"gitaly"
][
"repository"
]).
not_to
be_nil
...
@@ -604,7 +604,7 @@ describe API::Internal::Base do
...
@@ -604,7 +604,7 @@ describe API::Internal::Base do
it
do
it
do
archive
(
key
,
project
)
archive
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
end
end
end
end
...
@@ -616,7 +616,7 @@ describe API::Internal::Base do
...
@@ -616,7 +616,7 @@ describe API::Internal::Base do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
end
end
...
@@ -632,7 +632,7 @@ describe API::Internal::Base do
...
@@ -632,7 +632,7 @@ describe API::Internal::Base do
}
}
)
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
end
end
end
end
...
@@ -641,7 +641,7 @@ describe API::Internal::Base do
...
@@ -641,7 +641,7 @@ describe API::Internal::Base do
it
do
it
do
pull
(
OpenStruct
.
new
(
id:
0
),
project
)
pull
(
OpenStruct
.
new
(
id:
0
),
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
"status"
]).
to
be_falsey
expect
(
json_response
[
"status"
]).
to
be_falsey
end
end
end
end
...
@@ -714,14 +714,14 @@ describe API::Internal::Base do
...
@@ -714,14 +714,14 @@ describe API::Internal::Base do
it
'rejects the push'
do
it
'rejects the push'
do
push
(
key
,
project
)
push
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'status'
]).
to
be_falsy
expect
(
json_response
[
'status'
]).
to
be_falsy
end
end
it
'rejects the SSH pull'
do
it
'rejects the SSH pull'
do
pull
(
key
,
project
)
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'status'
]).
to
be_falsy
expect
(
json_response
[
'status'
]).
to
be_falsy
end
end
end
end
...
@@ -750,7 +750,7 @@ describe API::Internal::Base do
...
@@ -750,7 +750,7 @@ describe API::Internal::Base do
#
#
# post api("/internal/notify_post_receive"), valid_params
# post api("/internal/notify_post_receive"), valid_params
#
#
# expect(response).to have_gitlab_http_status(
200
)
# expect(response).to have_gitlab_http_status(
:ok
)
# end
# end
#
#
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do
...
@@ -762,7 +762,7 @@ describe API::Internal::Base do
...
@@ -762,7 +762,7 @@ describe API::Internal::Base do
#
#
# post api("/internal/notify_post_receive"), valid_wiki_params
# post api("/internal/notify_post_receive"), valid_wiki_params
#
#
# expect(response).to have_gitlab_http_status(
200
)
# expect(response).to have_gitlab_http_status(
:ok
)
# end
# end
#
#
# it "returns 500 if the gitaly call fails" do
# it "returns 500 if the gitaly call fails" do
...
@@ -771,7 +771,7 @@ describe API::Internal::Base do
...
@@ -771,7 +771,7 @@ describe API::Internal::Base do
#
#
# post api("/internal/notify_post_receive"), valid_params
# post api("/internal/notify_post_receive"), valid_params
#
#
# expect(response).to have_gitlab_http_status(
500
)
# expect(response).to have_gitlab_http_status(
:internal_server_error
)
# end
# end
#
#
# context 'with a gl_repository parameter' do
# context 'with a gl_repository parameter' do
...
@@ -792,7 +792,7 @@ describe API::Internal::Base do
...
@@ -792,7 +792,7 @@ describe API::Internal::Base do
#
#
# post api("/internal/notify_post_receive"), valid_params
# post api("/internal/notify_post_receive"), valid_params
#
#
# expect(response).to have_gitlab_http_status(
200
)
# expect(response).to have_gitlab_http_status(
:ok
)
# end
# end
#
#
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do
...
@@ -804,7 +804,7 @@ describe API::Internal::Base do
...
@@ -804,7 +804,7 @@ describe API::Internal::Base do
#
#
# post api("/internal/notify_post_receive"), valid_wiki_params
# post api("/internal/notify_post_receive"), valid_wiki_params
#
#
# expect(response).to have_gitlab_http_status(
200
)
# expect(response).to have_gitlab_http_status(
:ok
)
# end
# end
# end
# end
# end
# end
...
@@ -961,7 +961,7 @@ describe API::Internal::Base do
...
@@ -961,7 +961,7 @@ describe API::Internal::Base do
it
'outputs a broadcast message'
do
it
'outputs a broadcast message'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
to
include
(
build_alert_message
(
broadcast_message
.
message
))
expect
(
json_response
[
'messages'
]).
to
include
(
build_alert_message
(
broadcast_message
.
message
))
end
end
end
end
...
@@ -970,7 +970,7 @@ describe API::Internal::Base do
...
@@ -970,7 +970,7 @@ describe API::Internal::Base do
it
'does not output a broadcast message'
do
it
'does not output a broadcast message'
do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
has_alert_messages?
(
json_response
[
'messages'
])).
to
be_falsey
expect
(
has_alert_messages?
(
json_response
[
'messages'
])).
to
be_falsey
end
end
end
end
...
@@ -981,7 +981,7 @@ describe API::Internal::Base do
...
@@ -981,7 +981,7 @@ describe API::Internal::Base do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
has_alert_messages?
(
json_response
[
'messages'
])).
to
be_falsey
expect
(
has_alert_messages?
(
json_response
[
'messages'
])).
to
be_falsey
end
end
end
end
...
@@ -993,7 +993,7 @@ describe API::Internal::Base do
...
@@ -993,7 +993,7 @@ describe API::Internal::Base do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
to
include
(
build_basic_message
(
project_moved
.
message
))
expect
(
json_response
[
'messages'
]).
to
include
(
build_basic_message
(
project_moved
.
message
))
end
end
end
end
...
@@ -1005,7 +1005,7 @@ describe API::Internal::Base do
...
@@ -1005,7 +1005,7 @@ describe API::Internal::Base do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'messages'
]).
to
include
(
build_basic_message
(
project_created
.
message
))
expect
(
json_response
[
'messages'
]).
to
include
(
build_basic_message
(
project_created
.
message
))
end
end
end
end
...
@@ -1018,7 +1018,7 @@ describe API::Internal::Base do
...
@@ -1018,7 +1018,7 @@ describe API::Internal::Base do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -1032,7 +1032,7 @@ describe API::Internal::Base do
...
@@ -1032,7 +1032,7 @@ describe API::Internal::Base do
post
api
(
'/internal/post_receive'
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
end
end
...
...
spec/requests/api/internal/pages_spec.rb
View file @
1d6bb047
...
@@ -22,7 +22,7 @@ describe API::Internal::Pages do
...
@@ -22,7 +22,7 @@ describe API::Internal::Pages do
it
'responds with 404 Not Found'
do
it
'responds with 404 Not Found'
do
query_host
(
'pages.gitlab.io'
)
query_host
(
'pages.gitlab.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -31,7 +31,7 @@ describe API::Internal::Pages do
...
@@ -31,7 +31,7 @@ describe API::Internal::Pages do
it
'responds with 401 Unauthorized'
do
it
'responds with 401 Unauthorized'
do
query_host
(
'pages.gitlab.io'
)
query_host
(
'pages.gitlab.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
...
@@ -51,7 +51,7 @@ describe API::Internal::Pages do
...
@@ -51,7 +51,7 @@ describe API::Internal::Pages do
it
'responds with 204 no content'
do
it
'responds with 204 no content'
do
query_host
(
'pages.gitlab.io'
)
query_host
(
'pages.gitlab.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
expect
(
response
.
body
).
to
be_empty
expect
(
response
.
body
).
to
be_empty
end
end
end
end
...
@@ -65,7 +65,7 @@ describe API::Internal::Pages do
...
@@ -65,7 +65,7 @@ describe API::Internal::Pages do
it
'responds with 204 No Content'
do
it
'responds with 204 No Content'
do
query_host
(
'pages.gitlab.io'
)
query_host
(
'pages.gitlab.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
end
end
...
@@ -75,7 +75,7 @@ describe API::Internal::Pages do
...
@@ -75,7 +75,7 @@ describe API::Internal::Pages do
query_host
(
'pages.gitlab.io'
)
query_host
(
'pages.gitlab.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'internal/pages/virtual_domain'
)
expect
(
response
).
to
match_response_schema
(
'internal/pages/virtual_domain'
)
expect
(
json_response
[
'certificate'
]).
to
eq
(
pages_domain
.
certificate
)
expect
(
json_response
[
'certificate'
]).
to
eq
(
pages_domain
.
certificate
)
...
@@ -114,7 +114,7 @@ describe API::Internal::Pages do
...
@@ -114,7 +114,7 @@ describe API::Internal::Pages do
query_host
(
'mygroup.gitlab-pages.io'
)
query_host
(
'mygroup.gitlab-pages.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'internal/pages/virtual_domain'
)
expect
(
response
).
to
match_response_schema
(
'internal/pages/virtual_domain'
)
expect
(
json_response
[
'lookup_paths'
]).
to
eq
(
expect
(
json_response
[
'lookup_paths'
]).
to
eq
(
...
@@ -141,7 +141,7 @@ describe API::Internal::Pages do
...
@@ -141,7 +141,7 @@ describe API::Internal::Pages do
query_host
(
'mygroup.gitlab-pages.io'
)
query_host
(
'mygroup.gitlab-pages.io'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'internal/pages/virtual_domain'
)
expect
(
response
).
to
match_response_schema
(
'internal/pages/virtual_domain'
)
expect
(
json_response
[
'lookup_paths'
]).
to
eq
(
expect
(
json_response
[
'lookup_paths'
]).
to
eq
(
...
...
spec/requests/api/issues/get_group_issues_spec.rb
View file @
1d6bb047
...
@@ -74,7 +74,7 @@ describe API::Issues do
...
@@ -74,7 +74,7 @@ describe API::Issues do
it
'returns issues statistics'
do
it
'returns issues statistics'
do
get
api
(
"/groups/
#{
group
.
id
}
/issues_statistics"
,
user
),
params:
params
get
api
(
"/groups/
#{
group
.
id
}
/issues_statistics"
,
user
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'statistics'
]).
not_to
be_nil
expect
(
json_response
[
'statistics'
]).
not_to
be_nil
expect
(
json_response
[
'statistics'
][
'counts'
][
'all'
]).
to
eq
counts
[
:all
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'all'
]).
to
eq
counts
[
:all
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'closed'
]).
to
eq
counts
[
:closed
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'closed'
]).
to
eq
counts
[
:closed
]
...
@@ -345,7 +345,7 @@ describe API::Issues do
...
@@ -345,7 +345,7 @@ describe API::Issues do
it
'exposes known attributes'
do
it
'exposes known attributes'
do
get
api
(
base_url
,
admin
)
get
api
(
base_url
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
last
.
keys
).
to
include
(
*
%w(id iid project_id title description)
)
expect
(
json_response
.
last
.
keys
).
to
include
(
*
%w(id iid project_id title description)
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
end
end
...
@@ -529,7 +529,7 @@ describe API::Issues do
...
@@ -529,7 +529,7 @@ describe API::Issues do
it
'returns an array of issues with no milestone'
do
it
'returns an array of issues with no milestone'
do
get
api
(
base_url
,
user
),
params:
{
milestone:
no_milestone_title
}
get
api
(
base_url
,
user
),
params:
{
milestone:
no_milestone_title
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect_paginated_array_response
(
group_confidential_issue
.
id
)
expect_paginated_array_response
(
group_confidential_issue
.
id
)
end
end
...
@@ -676,14 +676,14 @@ describe API::Issues do
...
@@ -676,14 +676,14 @@ describe API::Issues do
it
'returns error when multiple assignees are passed'
do
it
'returns error when multiple assignees are passed'
do
get
api
(
base_url
,
user
),
params:
{
assignee_username:
[
assignee
.
username
,
another_assignee
.
username
],
scope:
'all'
}
get
api
(
base_url
,
user
),
params:
{
assignee_username:
[
assignee
.
username
,
another_assignee
.
username
],
scope:
'all'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
"error"
]).
to
include
(
"allows one value, but found 2"
)
expect
(
json_response
[
"error"
]).
to
include
(
"allows one value, but found 2"
)
end
end
it
'returns error when assignee_username and assignee_id are passed together'
do
it
'returns error when assignee_username and assignee_id are passed together'
do
get
api
(
base_url
,
user
),
params:
{
assignee_username:
[
assignee
.
username
],
assignee_id:
another_assignee
.
id
,
scope:
'all'
}
get
api
(
base_url
,
user
),
params:
{
assignee_username:
[
assignee
.
username
],
assignee_id:
another_assignee
.
id
,
scope:
'all'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
"error"
]).
to
include
(
"mutually exclusive"
)
expect
(
json_response
[
"error"
]).
to
include
(
"mutually exclusive"
)
end
end
end
end
...
...
spec/requests/api/issues/get_project_issues_spec.rb
View file @
1d6bb047
...
@@ -93,7 +93,7 @@ describe API::Issues do
...
@@ -93,7 +93,7 @@ describe API::Issues do
it
'returns project issues statistics'
do
it
'returns project issues statistics'
do
get
api
(
"/issues_statistics"
,
user
),
params:
params
get
api
(
"/issues_statistics"
,
user
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'statistics'
]).
not_to
be_nil
expect
(
json_response
[
'statistics'
]).
not_to
be_nil
expect
(
json_response
[
'statistics'
][
'counts'
][
'all'
]).
to
eq
counts
[
:all
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'all'
]).
to
eq
counts
[
:all
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'closed'
]).
to
eq
counts
[
:closed
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'closed'
]).
to
eq
counts
[
:closed
]
...
@@ -196,7 +196,7 @@ describe API::Issues do
...
@@ -196,7 +196,7 @@ describe API::Issues do
get
api
(
"/projects/
#{
max_project_id
+
1
}
/issues"
,
non_member
)
get
api
(
"/projects/
#{
max_project_id
+
1
}
/issues"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 on private projects for other users'
do
it
'returns 404 on private projects for other users'
do
...
@@ -205,7 +205,7 @@ describe API::Issues do
...
@@ -205,7 +205,7 @@ describe API::Issues do
get
api
(
"/projects/
#{
private_project
.
id
}
/issues"
,
non_member
)
get
api
(
"/projects/
#{
private_project
.
id
}
/issues"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns no issues when user has access to project but not issues'
do
it
'returns no issues when user has access to project but not issues'
do
...
@@ -472,7 +472,7 @@ describe API::Issues do
...
@@ -472,7 +472,7 @@ describe API::Issues do
it
'exposes known attributes'
do
it
'exposes known attributes'
do
get
api
(
"
#{
base_url
}
/issues"
,
user
)
get
api
(
"
#{
base_url
}
/issues"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
last
.
keys
).
to
include
(
*
%w(id iid project_id title description)
)
expect
(
json_response
.
last
.
keys
).
to
include
(
*
%w(id iid project_id title description)
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
end
end
...
@@ -565,14 +565,14 @@ describe API::Issues do
...
@@ -565,14 +565,14 @@ describe API::Issues do
it
'returns error when multiple assignees are passed'
do
it
'returns error when multiple assignees are passed'
do
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
,
another_assignee
.
username
],
scope:
'all'
}
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
,
another_assignee
.
username
],
scope:
'all'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
"error"
]).
to
include
(
"allows one value, but found 2"
)
expect
(
json_response
[
"error"
]).
to
include
(
"allows one value, but found 2"
)
end
end
it
'returns error when assignee_username and assignee_id are passed together'
do
it
'returns error when assignee_username and assignee_id are passed together'
do
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
],
assignee_id:
another_assignee
.
id
,
scope:
'all'
}
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
],
assignee_id:
another_assignee
.
id
,
scope:
'all'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
"error"
]).
to
include
(
"mutually exclusive"
)
expect
(
json_response
[
"error"
]).
to
include
(
"mutually exclusive"
)
end
end
end
end
...
@@ -583,14 +583,14 @@ describe API::Issues do
...
@@ -583,14 +583,14 @@ describe API::Issues do
it
'returns public issues'
do
it
'returns public issues'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
it
'exposes known attributes'
do
it
'exposes known attributes'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'id'
]).
to
eq
(
issue
.
id
)
expect
(
json_response
[
'id'
]).
to
eq
(
issue
.
id
)
expect
(
json_response
[
'iid'
]).
to
eq
(
issue
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
issue
.
iid
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
issue
.
project
.
id
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
issue
.
project
.
id
)
...
@@ -630,7 +630,7 @@ describe API::Issues do
...
@@ -630,7 +630,7 @@ describe API::Issues do
it
'exposes the closed_at attribute'
do
it
'exposes the closed_at attribute'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
closed_issue
.
iid
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
closed_issue
.
iid
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'closed_at'
]).
to
be_present
expect
(
json_response
[
'closed_at'
]).
to
be_present
end
end
...
@@ -650,39 +650,39 @@ describe API::Issues do
...
@@ -650,39 +650,39 @@ describe API::Issues do
it
'returns a project issue by internal id'
do
it
'returns a project issue by internal id'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
issue
.
title
)
expect
(
json_response
[
'title'
]).
to
eq
(
issue
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
issue
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
issue
.
iid
)
end
end
it
'returns 404 if issue id not found'
do
it
'returns 404 if issue id not found'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/54321"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/54321"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 if the issue ID is used'
do
it
'returns 404 if the issue ID is used'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'confidential issues'
do
context
'confidential issues'
do
it
'returns 404 for non project members'
do
it
'returns 404 for non project members'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
non_member
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 for project members with guest role'
do
it
'returns 404 for project members with guest role'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
guest
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
guest
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns confidential issue for project members'
do
it
'returns confidential issue for project members'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
end
end
...
@@ -690,7 +690,7 @@ describe API::Issues do
...
@@ -690,7 +690,7 @@ describe API::Issues do
it
'returns confidential issue for author'
do
it
'returns confidential issue for author'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
author
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
author
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
end
end
...
@@ -698,7 +698,7 @@ describe API::Issues do
...
@@ -698,7 +698,7 @@ describe API::Issues do
it
'returns confidential issue for assignee'
do
it
'returns confidential issue for assignee'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
assignee
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
assignee
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
end
end
...
@@ -706,7 +706,7 @@ describe API::Issues do
...
@@ -706,7 +706,7 @@ describe API::Issues do
it
'returns confidential issue for admin'
do
it
'returns confidential issue for admin'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
admin
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'title'
]).
to
eq
(
confidential_issue
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
confidential_issue
.
iid
)
end
end
...
@@ -744,7 +744,7 @@ describe API::Issues do
...
@@ -744,7 +744,7 @@ describe API::Issues do
it
"returns 404 when issue doesn't exists"
do
it
"returns 404 when issue doesn't exists"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/0/closed_by"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/0/closed_by"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -774,7 +774,7 @@ describe API::Issues do
...
@@ -774,7 +774,7 @@ describe API::Issues do
get_related_merge_requests
(
project
.
id
,
issue
.
iid
)
get_related_merge_requests
(
project
.
id
,
issue
.
iid
)
expect_paginated_array_response
(
related_mr
.
id
)
expect_paginated_array_response
(
related_mr
.
id
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
end
end
...
@@ -785,7 +785,7 @@ describe API::Issues do
...
@@ -785,7 +785,7 @@ describe API::Issues do
get_related_merge_requests
(
private_project
.
id
,
private_issue
.
iid
)
get_related_merge_requests
(
private_project
.
id
,
private_issue
.
iid
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -824,7 +824,7 @@ describe API::Issues do
...
@@ -824,7 +824,7 @@ describe API::Issues do
it
"returns 404 when issue doesn't exists"
do
it
"returns 404 when issue doesn't exists"
do
get_related_merge_requests
(
project
.
id
,
0
,
user
)
get_related_merge_requests
(
project
.
id
,
0
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -835,14 +835,14 @@ describe API::Issues do
...
@@ -835,14 +835,14 @@ describe API::Issues do
it
'returns unauthorized'
do
it
'returns unauthorized'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
end
it
'exposes known attributes'
do
it
'exposes known attributes'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
admin
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
expect
(
json_response
[
'ip_address'
]).
to
eq
(
user_agent_detail
.
ip_address
)
expect
(
json_response
[
'ip_address'
]).
to
eq
(
user_agent_detail
.
ip_address
)
expect
(
json_response
[
'akismet_submitted'
]).
to
eq
(
user_agent_detail
.
submitted
)
expect
(
json_response
[
'akismet_submitted'
]).
to
eq
(
user_agent_detail
.
submitted
)
...
@@ -851,7 +851,7 @@ describe API::Issues do
...
@@ -851,7 +851,7 @@ describe API::Issues do
it
'returns unauthorized for non-admin users'
do
it
'returns unauthorized for non-admin users'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
...
@@ -863,7 +863,7 @@ describe API::Issues do
...
@@ -863,7 +863,7 @@ describe API::Issues do
it
'returns 404 if the issue is confidential'
do
it
'returns 404 if the issue is confidential'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
/participants"
,
non_member
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
/participants"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
spec/requests/api/issues/issues_spec.rb
View file @
1d6bb047
...
@@ -76,7 +76,7 @@ describe API::Issues do
...
@@ -76,7 +76,7 @@ describe API::Issues do
it
'returns issues statistics'
do
it
'returns issues statistics'
do
get
api
(
"/issues_statistics"
,
user
),
params:
params
get
api
(
"/issues_statistics"
,
user
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'statistics'
]).
not_to
be_nil
expect
(
json_response
[
'statistics'
]).
not_to
be_nil
expect
(
json_response
[
'statistics'
][
'counts'
][
'all'
]).
to
eq
counts
[
:all
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'all'
]).
to
eq
counts
[
:all
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'closed'
]).
to
eq
counts
[
:closed
]
expect
(
json_response
[
'statistics'
][
'counts'
][
'closed'
]).
to
eq
counts
[
:closed
]
...
@@ -89,39 +89,39 @@ describe API::Issues do
...
@@ -89,39 +89,39 @@ describe API::Issues do
it
'returns an array of all issues'
do
it
'returns an array of all issues'
do
get
api
(
'/issues'
),
params:
{
scope:
'all'
}
get
api
(
'/issues'
),
params:
{
scope:
'all'
}
expect
(
response
).
to
have_
http_status
(
200
)
expect
(
response
).
to
have_
gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
end
end
it
'returns authentication error without any scope'
do
it
'returns authentication error without any scope'
do
get
api
(
'/issues'
)
get
api
(
'/issues'
)
expect
(
response
).
to
have_
http_status
(
401
)
expect
(
response
).
to
have_
gitlab_http_status
(
:unauthorized
)
end
end
it
'returns authentication error when scope is assigned-to-me'
do
it
'returns authentication error when scope is assigned-to-me'
do
get
api
(
'/issues'
),
params:
{
scope:
'assigned-to-me'
}
get
api
(
'/issues'
),
params:
{
scope:
'assigned-to-me'
}
expect
(
response
).
to
have_
http_status
(
401
)
expect
(
response
).
to
have_
gitlab_http_status
(
:unauthorized
)
end
end
it
'returns authentication error when scope is created-by-me'
do
it
'returns authentication error when scope is created-by-me'
do
get
api
(
'/issues'
),
params:
{
scope:
'created-by-me'
}
get
api
(
'/issues'
),
params:
{
scope:
'created-by-me'
}
expect
(
response
).
to
have_
http_status
(
401
)
expect
(
response
).
to
have_
gitlab_http_status
(
:unauthorized
)
end
end
it
'returns an array of issues matching state in milestone'
do
it
'returns an array of issues matching state in milestone'
do
get
api
(
'/issues'
),
params:
{
milestone:
'foo'
,
scope:
'all'
}
get
api
(
'/issues'
),
params:
{
milestone:
'foo'
,
scope:
'all'
}
expect
(
response
).
to
have_
http_status
(
200
)
expect
(
response
).
to
have_
gitlab_http_status
(
:ok
)
expect_paginated_array_response
([])
expect_paginated_array_response
([])
end
end
it
'returns an array of issues matching state in milestone'
do
it
'returns an array of issues matching state in milestone'
do
get
api
(
'/issues'
),
params:
{
milestone:
milestone
.
title
,
scope:
'all'
}
get
api
(
'/issues'
),
params:
{
milestone:
milestone
.
title
,
scope:
'all'
}
expect
(
response
).
to
have_
http_status
(
200
)
expect
(
response
).
to
have_
gitlab_http_status
(
:ok
)
expect_paginated_array_response
([
issue
.
id
,
closed_issue
.
id
])
expect_paginated_array_response
([
issue
.
id
,
closed_issue
.
id
])
end
end
...
@@ -129,19 +129,19 @@ describe API::Issues do
...
@@ -129,19 +129,19 @@ describe API::Issues do
it
'returns authentication error without any scope'
do
it
'returns authentication error without any scope'
do
get
api
(
'/issues_statistics'
)
get
api
(
'/issues_statistics'
)
expect
(
response
).
to
have_
http_status
(
401
)
expect
(
response
).
to
have_
gitlab_http_status
(
:unauthorized
)
end
end
it
'returns authentication error when scope is assigned_to_me'
do
it
'returns authentication error when scope is assigned_to_me'
do
get
api
(
'/issues_statistics'
),
params:
{
scope:
'assigned_to_me'
}
get
api
(
'/issues_statistics'
),
params:
{
scope:
'assigned_to_me'
}
expect
(
response
).
to
have_
http_status
(
401
)
expect
(
response
).
to
have_
gitlab_http_status
(
:unauthorized
)
end
end
it
'returns authentication error when scope is created_by_me'
do
it
'returns authentication error when scope is created_by_me'
do
get
api
(
'/issues_statistics'
),
params:
{
scope:
'created_by_me'
}
get
api
(
'/issues_statistics'
),
params:
{
scope:
'created_by_me'
}
expect
(
response
).
to
have_
http_status
(
401
)
expect
(
response
).
to
have_
gitlab_http_status
(
:unauthorized
)
end
end
context
'no state is treated as all state'
do
context
'no state is treated as all state'
do
...
@@ -642,14 +642,14 @@ describe API::Issues do
...
@@ -642,14 +642,14 @@ describe API::Issues do
it
'accepts only predefined order by params'
do
it
'accepts only predefined order by params'
do
API
::
Helpers
::
IssuesHelpers
.
sort_options
.
each
do
|
sort_opt
|
API
::
Helpers
::
IssuesHelpers
.
sort_options
.
each
do
|
sort_opt
|
get
api
(
'/issues'
,
user
),
params:
{
order_by:
sort_opt
,
sort:
'asc'
}
get
api
(
'/issues'
,
user
),
params:
{
order_by:
sort_opt
,
sort:
'asc'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
it
'fails to sort with non predefined options'
do
it
'fails to sort with non predefined options'
do
%w(milestone title abracadabra)
.
each
do
|
sort_opt
|
%w(milestone title abracadabra)
.
each
do
|
sort_opt
|
get
api
(
'/issues'
,
user
),
params:
{
order_by:
sort_opt
,
sort:
'asc'
}
get
api
(
'/issues'
,
user
),
params:
{
order_by:
sort_opt
,
sort:
'asc'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
end
end
end
end
end
end
...
@@ -657,14 +657,14 @@ describe API::Issues do
...
@@ -657,14 +657,14 @@ describe API::Issues do
it
'matches V4 response schema'
do
it
'matches V4 response schema'
do
get
api
(
'/issues'
,
user
)
get
api
(
'/issues'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
end
end
it
'returns a related merge request count of 0 if there are no related merge requests'
do
it
'returns a related merge request count of 0 if there are no related merge requests'
do
get
api
(
'/issues'
,
user
)
get
api
(
'/issues'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
json_response
.
first
).
to
include
(
'merge_requests_count'
=>
0
)
expect
(
json_response
.
first
).
to
include
(
'merge_requests_count'
=>
0
)
end
end
...
@@ -674,7 +674,7 @@ describe API::Issues do
...
@@ -674,7 +674,7 @@ describe API::Issues do
get
api
(
'/issues'
,
user
)
get
api
(
'/issues'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
json_response
.
first
).
to
include
(
'merge_requests_count'
=>
1
)
expect
(
json_response
.
first
).
to
include
(
'merge_requests_count'
=>
1
)
end
end
...
@@ -767,14 +767,14 @@ describe API::Issues do
...
@@ -767,14 +767,14 @@ describe API::Issues do
it
'returns error when multiple assignees are passed'
do
it
'returns error when multiple assignees are passed'
do
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
,
another_assignee
.
username
],
scope:
'all'
}
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
,
another_assignee
.
username
],
scope:
'all'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
"error"
]).
to
include
(
"allows one value, but found 2"
)
expect
(
json_response
[
"error"
]).
to
include
(
"allows one value, but found 2"
)
end
end
it
'returns error when assignee_username and assignee_id are passed together'
do
it
'returns error when assignee_username and assignee_id are passed together'
do
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
],
assignee_id:
another_assignee
.
id
,
scope:
'all'
}
get
api
(
"/issues"
,
user
),
params:
{
assignee_username:
[
assignee
.
username
],
assignee_id:
another_assignee
.
id
,
scope:
'all'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
"error"
]).
to
include
(
"mutually exclusive"
)
expect
(
json_response
[
"error"
]).
to
include
(
"mutually exclusive"
)
end
end
end
end
...
@@ -835,7 +835,7 @@ describe API::Issues do
...
@@ -835,7 +835,7 @@ describe API::Issues do
it
'exposes full reference path'
do
it
'exposes full reference path'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'references'
][
'short'
]).
to
eq
(
"#
#{
issue
.
iid
}
"
)
expect
(
json_response
[
'references'
][
'short'
]).
to
eq
(
"#
#{
issue
.
iid
}
"
)
expect
(
json_response
[
'references'
][
'relative'
]).
to
eq
(
"#
#{
issue
.
iid
}
"
)
expect
(
json_response
[
'references'
][
'relative'
]).
to
eq
(
"#
#{
issue
.
iid
}
"
)
expect
(
json_response
[
'references'
][
'full'
]).
to
eq
(
"
#{
project
.
parent
.
path
}
/
#{
project
.
path
}
#
#{
issue
.
iid
}
"
)
expect
(
json_response
[
'references'
][
'full'
]).
to
eq
(
"
#{
project
.
parent
.
path
}
/
#{
project
.
path
}
#
#{
issue
.
iid
}
"
)
...
@@ -845,12 +845,12 @@ describe API::Issues do
...
@@ -845,12 +845,12 @@ describe API::Issues do
describe
'DELETE /projects/:id/issues/:issue_iid'
do
describe
'DELETE /projects/:id/issues/:issue_iid'
do
it
'rejects a non member from deleting an issue'
do
it
'rejects a non member from deleting an issue'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
non_member
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
it
'rejects a developer from deleting an issue'
do
it
'rejects a developer from deleting an issue'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
author
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
author
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
context
'when the user is project owner'
do
context
'when the user is project owner'
do
...
@@ -860,7 +860,7 @@ describe API::Issues do
...
@@ -860,7 +860,7 @@ describe API::Issues do
it
'deletes the issue if an admin requests it'
do
it
'deletes the issue if an admin requests it'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
owner
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
owner
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
it_behaves_like
'412 response'
do
it_behaves_like
'412 response'
do
...
@@ -872,14 +872,14 @@ describe API::Issues do
...
@@ -872,14 +872,14 @@ describe API::Issues do
it
'returns 404 when trying to delete an issue'
do
it
'returns 404 when trying to delete an issue'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/123"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/123"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
it
'returns 404 when using the issue ID instead of IID'
do
it
'returns 404 when using the issue ID instead of IID'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
)
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
...
spec/requests/api/issues/post_projects_issues_spec.rb
View file @
1d6bb047
...
@@ -75,7 +75,7 @@ describe API::Issues do
...
@@ -75,7 +75,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
assignee_id:
user2
.
id
}
params:
{
title:
'new issue'
,
assignee_id:
user2
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'assignee'
][
'name'
]).
to
eq
(
user2
.
name
)
expect
(
json_response
[
'assignee'
][
'name'
]).
to
eq
(
user2
.
name
)
expect
(
json_response
[
'assignees'
].
first
[
'name'
]).
to
eq
(
user2
.
name
)
expect
(
json_response
[
'assignees'
].
first
[
'name'
]).
to
eq
(
user2
.
name
)
...
@@ -85,7 +85,7 @@ describe API::Issues do
...
@@ -85,7 +85,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
assignee_id:
''
}
params:
{
title:
'new issue'
,
assignee_id:
''
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'assignee'
]).
to
be_nil
expect
(
json_response
[
'assignee'
]).
to
be_nil
end
end
...
@@ -96,7 +96,7 @@ describe API::Issues do
...
@@ -96,7 +96,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
assignee_ids:
[
user2
.
id
,
guest
.
id
]
}
params:
{
title:
'new issue'
,
assignee_ids:
[
user2
.
id
,
guest
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'assignees'
].
count
).
to
eq
(
1
)
expect
(
json_response
[
'assignees'
].
count
).
to
eq
(
1
)
end
end
...
@@ -112,7 +112,7 @@ describe API::Issues do
...
@@ -112,7 +112,7 @@ describe API::Issues do
it
'renders 403'
do
it
'renders 403'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
not_member
),
params:
{
title:
'new issue'
}
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
not_member
),
params:
{
title:
'new issue'
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
...
@@ -122,7 +122,7 @@ describe API::Issues do
...
@@ -122,7 +122,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
params:
{
title:
'new issue'
,
iid:
9001
}
params:
{
title:
'new issue'
,
iid:
9001
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'iid'
]).
to
eq
9001
expect
(
json_response
[
'iid'
]).
to
eq
9001
end
end
end
end
...
@@ -132,7 +132,7 @@ describe API::Issues do
...
@@ -132,7 +132,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
iid:
9001
}
params:
{
title:
'new issue'
,
iid:
9001
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'iid'
]).
to
eq
9001
expect
(
json_response
[
'iid'
]).
to
eq
9001
end
end
end
end
...
@@ -146,7 +146,7 @@ describe API::Issues do
...
@@ -146,7 +146,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
group_project
.
id
}
/issues"
,
user2
),
post
api
(
"/projects/
#{
group_project
.
id
}
/issues"
,
user2
),
params:
{
title:
'new issue'
,
iid:
9001
}
params:
{
title:
'new issue'
,
iid:
9001
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'iid'
]).
to
eq
9001
expect
(
json_response
[
'iid'
]).
to
eq
9001
end
end
end
end
...
@@ -156,7 +156,7 @@ describe API::Issues do
...
@@ -156,7 +156,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user2
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user2
),
params:
{
title:
'new issue'
,
iid:
9001
}
params:
{
title:
'new issue'
,
iid:
9001
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'iid'
]).
not_to
eq
9001
expect
(
json_response
[
'iid'
]).
not_to
eq
9001
end
end
end
end
...
@@ -166,7 +166,7 @@ describe API::Issues do
...
@@ -166,7 +166,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
params:
{
title:
'new issue'
,
iid:
issue
.
iid
}
params:
{
title:
'new issue'
,
iid:
issue
.
iid
}
expect
(
response
).
to
have_gitlab_http_status
(
409
)
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
expect
(
json_response
[
'message'
]).
to
eq
'Duplicated issue'
expect
(
json_response
[
'message'
]).
to
eq
'Duplicated issue'
end
end
end
end
...
@@ -176,7 +176,7 @@ describe API::Issues do
...
@@ -176,7 +176,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
labels:
'label, label2'
,
weight:
3
,
assignee_ids:
[
user2
.
id
]
}
params:
{
title:
'new issue'
,
labels:
'label, label2'
,
weight:
3
,
assignee_ids:
[
user2
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'labels'
]).
to
eq
(
%w(label label2)
)
expect
(
json_response
[
'labels'
]).
to
eq
(
%w(label label2)
)
...
@@ -189,7 +189,7 @@ describe API::Issues do
...
@@ -189,7 +189,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
labels:
%w(label label2)
,
weight:
3
,
assignee_ids:
[
user2
.
id
]
}
params:
{
title:
'new issue'
,
labels:
%w(label label2)
,
weight:
3
,
assignee_ids:
[
user2
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'labels'
]).
to
eq
(
%w(label label2)
)
expect
(
json_response
[
'labels'
]).
to
eq
(
%w(label label2)
)
...
@@ -202,7 +202,7 @@ describe API::Issues do
...
@@ -202,7 +202,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
confidential:
true
}
params:
{
title:
'new issue'
,
confidential:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'confidential'
]).
to
be_truthy
expect
(
json_response
[
'confidential'
]).
to
be_truthy
end
end
...
@@ -211,7 +211,7 @@ describe API::Issues do
...
@@ -211,7 +211,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
confidential:
'y'
}
params:
{
title:
'new issue'
,
confidential:
'y'
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'confidential'
]).
to
be_truthy
expect
(
json_response
[
'confidential'
]).
to
be_truthy
end
end
...
@@ -220,7 +220,7 @@ describe API::Issues do
...
@@ -220,7 +220,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
confidential:
false
}
params:
{
title:
'new issue'
,
confidential:
false
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'confidential'
]).
to
be_falsy
expect
(
json_response
[
'confidential'
]).
to
be_falsy
end
end
...
@@ -229,13 +229,13 @@ describe API::Issues do
...
@@ -229,13 +229,13 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
confidential:
'foo'
}
params:
{
title:
'new issue'
,
confidential:
'foo'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'error'
]).
to
eq
(
'confidential is invalid'
)
expect
(
json_response
[
'error'
]).
to
eq
(
'confidential is invalid'
)
end
end
it
'returns a 400 bad request if title not given'
do
it
'returns a 400 bad request if title not given'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
labels:
'label, label2'
}
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
labels:
'label, label2'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
end
end
it
'allows special label names'
do
it
'allows special label names'
do
...
@@ -269,7 +269,7 @@ describe API::Issues do
...
@@ -269,7 +269,7 @@ describe API::Issues do
it
'returns 400 if title is too long'
do
it
'returns 400 if title is too long'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'g'
*
256
}
params:
{
title:
'g'
*
256
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
][
'title'
]).
to
eq
([
expect
(
json_response
[
'message'
][
'title'
]).
to
eq
([
'is too long (maximum is 255 characters)'
'is too long (maximum is 255 characters)'
])
])
...
@@ -317,7 +317,7 @@ describe API::Issues do
...
@@ -317,7 +317,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
{
title:
'new issue'
,
due_date:
due_date
}
params:
{
title:
'new issue'
,
due_date:
due_date
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'due_date'
]).
to
eq
(
due_date
)
expect
(
json_response
[
'due_date'
]).
to
eq
(
due_date
)
...
@@ -332,7 +332,7 @@ describe API::Issues do
...
@@ -332,7 +332,7 @@ describe API::Issues do
it
'sets the creation time on the new issue'
do
it
'sets the creation time on the new issue'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
params:
params
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
admin
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
end
end
end
end
...
@@ -341,7 +341,7 @@ describe API::Issues do
...
@@ -341,7 +341,7 @@ describe API::Issues do
it
'sets the creation time on the new issue'
do
it
'sets the creation time on the new issue'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
params
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
end
end
end
end
...
@@ -353,7 +353,7 @@ describe API::Issues do
...
@@ -353,7 +353,7 @@ describe API::Issues do
group
.
add_owner
(
user2
)
group
.
add_owner
(
user2
)
post
api
(
"/projects/
#{
group_project
.
id
}
/issues"
,
user2
),
params:
params
post
api
(
"/projects/
#{
group_project
.
id
}
/issues"
,
user2
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
creation_time
)
end
end
end
end
...
@@ -362,7 +362,7 @@ describe API::Issues do
...
@@ -362,7 +362,7 @@ describe API::Issues do
it
'ignores the given creation time'
do
it
'ignores the given creation time'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user2
),
params:
params
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user2
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
not_to
be_like_time
(
creation_time
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
not_to
be_like_time
(
creation_time
)
end
end
end
end
...
@@ -417,7 +417,7 @@ describe API::Issues do
...
@@ -417,7 +417,7 @@ describe API::Issues do
it
'returns correct status and message'
do
it
'returns correct status and message'
do
post_issue
post_issue
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
eq
({
'error'
=>
'Spam detected'
})
expect
(
json_response
[
'message'
]).
to
eq
({
'error'
=>
'Spam detected'
})
end
end
...
@@ -435,7 +435,7 @@ describe API::Issues do
...
@@ -435,7 +435,7 @@ describe API::Issues do
it
'returns correct status'
do
it
'returns correct status'
do
post_issue
post_issue
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
end
end
it
'creates a new spam log entry'
do
it
'creates a new spam log entry'
do
...
@@ -453,7 +453,7 @@ describe API::Issues do
...
@@ -453,7 +453,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
params:
{
to_project_id:
target_project
.
id
}
params:
{
to_project_id:
target_project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
target_project
.
id
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
target_project
.
id
)
end
end
...
@@ -462,7 +462,7 @@ describe API::Issues do
...
@@ -462,7 +462,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
params:
{
to_project_id:
project
.
id
}
params:
{
to_project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
eq
(
s_
(
'MoveIssue|Cannot move issue to project it originates from!'
))
expect
(
json_response
[
'message'
]).
to
eq
(
s_
(
'MoveIssue|Cannot move issue to project it originates from!'
))
end
end
end
end
...
@@ -472,7 +472,7 @@ describe API::Issues do
...
@@ -472,7 +472,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
params:
{
to_project_id:
target_project2
.
id
}
params:
{
to_project_id:
target_project2
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
eq
(
s_
(
'MoveIssue|Cannot move issue due to insufficient permissions!'
))
expect
(
json_response
[
'message'
]).
to
eq
(
s_
(
'MoveIssue|Cannot move issue due to insufficient permissions!'
))
end
end
end
end
...
@@ -481,7 +481,7 @@ describe API::Issues do
...
@@ -481,7 +481,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
admin
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
admin
),
params:
{
to_project_id:
target_project2
.
id
}
params:
{
to_project_id:
target_project2
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
target_project2
.
id
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
target_project2
.
id
)
end
end
...
@@ -490,7 +490,7 @@ describe API::Issues do
...
@@ -490,7 +490,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/move"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/move"
,
user
),
params:
{
to_project_id:
target_project
.
id
}
params:
{
to_project_id:
target_project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Issue Not Found'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Issue Not Found'
)
end
end
end
end
...
@@ -500,7 +500,7 @@ describe API::Issues do
...
@@ -500,7 +500,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/move"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/move"
,
user
),
params:
{
to_project_id:
target_project
.
id
}
params:
{
to_project_id:
target_project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Issue Not Found'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Issue Not Found'
)
end
end
end
end
...
@@ -510,7 +510,7 @@ describe API::Issues do
...
@@ -510,7 +510,7 @@ describe API::Issues do
post
api
(
"/projects/0/issues/
#{
issue
.
iid
}
/move"
,
user
),
post
api
(
"/projects/0/issues/
#{
issue
.
iid
}
/move"
,
user
),
params:
{
to_project_id:
target_project
.
id
}
params:
{
to_project_id:
target_project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Project Not Found'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Project Not Found'
)
end
end
end
end
...
@@ -520,7 +520,7 @@ describe API::Issues do
...
@@ -520,7 +520,7 @@ describe API::Issues do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/move"
,
user
),
params:
{
to_project_id:
0
}
params:
{
to_project_id:
0
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -529,32 +529,32 @@ describe API::Issues do
...
@@ -529,32 +529,32 @@ describe API::Issues do
it
'subscribes to an issue'
do
it
'subscribes to an issue'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/subscribe"
,
user2
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/subscribe"
,
user2
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
true
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
true
)
end
end
it
'returns 304 if already subscribed'
do
it
'returns 304 if already subscribed'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/subscribe"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/subscribe"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
304
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_modified
)
end
end
it
'returns 404 if the issue is not found'
do
it
'returns 404 if the issue is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/subscribe"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/subscribe"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 if the issue ID is used instead of the iid'
do
it
'returns 404 if the issue ID is used instead of the iid'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/subscribe"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/subscribe"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 if the issue is confidential'
do
it
'returns 404 if the issue is confidential'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
/subscribe"
,
non_member
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
/subscribe"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -562,32 +562,32 @@ describe API::Issues do
...
@@ -562,32 +562,32 @@ describe API::Issues do
it
'unsubscribes from an issue'
do
it
'unsubscribes from an issue'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/unsubscribe"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/unsubscribe"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
false
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
false
)
end
end
it
'returns 304 if not subscribed'
do
it
'returns 304 if not subscribed'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/unsubscribe"
,
user2
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/unsubscribe"
,
user2
)
expect
(
response
).
to
have_gitlab_http_status
(
304
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_modified
)
end
end
it
'returns 404 if the issue is not found'
do
it
'returns 404 if the issue is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/unsubscribe"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/123/unsubscribe"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 if using the issue ID instead of iid'
do
it
'returns 404 if using the issue ID instead of iid'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/unsubscribe"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/unsubscribe"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 if the issue is confidential'
do
it
'returns 404 if the issue is confidential'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
/unsubscribe"
,
non_member
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
/unsubscribe"
,
non_member
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
spec/requests/api/issues/put_projects_issues_spec.rb
View file @
1d6bb047
...
@@ -73,7 +73,7 @@ describe API::Issues do
...
@@ -73,7 +73,7 @@ describe API::Issues do
it
'updates a project issue'
do
it
'updates a project issue'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
end
end
...
@@ -81,13 +81,13 @@ describe API::Issues do
...
@@ -81,13 +81,13 @@ describe API::Issues do
it
'returns 404 error if issue iid not found'
do
it
'returns 404 error if issue iid not found'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/44444"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/44444"
,
user
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 error if issue id is used instead of the iid'
do
it
'returns 404 error if issue id is used instead of the iid'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'allows special label names'
do
it
'allows special label names'
do
...
@@ -124,33 +124,33 @@ describe API::Issues do
...
@@ -124,33 +124,33 @@ describe API::Issues do
it
'returns 403 for non project members'
do
it
'returns 403 for non project members'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
non_member
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
non_member
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
it
'returns 403 for project members with guest role'
do
it
'returns 403 for project members with guest role'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
guest
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
guest
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
it
'updates a confidential issue for project members'
do
it
'updates a confidential issue for project members'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
end
end
it
'updates a confidential issue for author'
do
it
'updates a confidential issue for author'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
author
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
author
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
end
end
it
'updates a confidential issue for admin'
do
it
'updates a confidential issue for admin'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
admin
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
admin
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
end
end
...
@@ -158,7 +158,7 @@ describe API::Issues do
...
@@ -158,7 +158,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
confidential:
true
}
params:
{
confidential:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'confidential'
]).
to
be_truthy
expect
(
json_response
[
'confidential'
]).
to
be_truthy
end
end
...
@@ -166,7 +166,7 @@ describe API::Issues do
...
@@ -166,7 +166,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
),
params:
{
confidential:
false
}
params:
{
confidential:
false
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'confidential'
]).
to
be_falsy
expect
(
json_response
[
'confidential'
]).
to
be_falsy
end
end
...
@@ -174,7 +174,7 @@ describe API::Issues do
...
@@ -174,7 +174,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
iid
}
"
,
user
),
params:
{
confidential:
'foo'
}
params:
{
confidential:
'foo'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'error'
]).
to
eq
(
'confidential is invalid'
)
expect
(
json_response
[
'error'
]).
to
eq
(
'confidential is invalid'
)
end
end
end
end
...
@@ -214,7 +214,7 @@ describe API::Issues do
...
@@ -214,7 +214,7 @@ describe API::Issues do
it
'returns correct status and message'
do
it
'returns correct status and message'
do
update_issue
update_issue
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
).
to
include
(
'message'
=>
{
'error'
=>
'Spam detected'
})
expect
(
json_response
).
to
include
(
'message'
=>
{
'error'
=>
'Spam detected'
})
end
end
...
@@ -232,7 +232,7 @@ describe API::Issues do
...
@@ -232,7 +232,7 @@ describe API::Issues do
it
'returns correct status and message'
do
it
'returns correct status and message'
do
update_issue
update_issue
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'creates a new spam log entry'
do
it
'creates a new spam log entry'
do
...
@@ -248,7 +248,7 @@ describe API::Issues do
...
@@ -248,7 +248,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
assignee_id:
0
}
params:
{
assignee_id:
0
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'assignee'
]).
to
be_nil
expect
(
json_response
[
'assignee'
]).
to
be_nil
end
end
...
@@ -257,7 +257,7 @@ describe API::Issues do
...
@@ -257,7 +257,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
assignee_id:
user2
.
id
}
params:
{
assignee_id:
user2
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'assignee'
][
'name'
]).
to
eq
(
user2
.
name
)
expect
(
json_response
[
'assignee'
][
'name'
]).
to
eq
(
user2
.
name
)
end
end
...
@@ -267,7 +267,7 @@ describe API::Issues do
...
@@ -267,7 +267,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
assignee_ids:
[
0
]
}
params:
{
assignee_ids:
[
0
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'assignees'
]).
to
be_empty
expect
(
json_response
[
'assignees'
]).
to
be_empty
end
end
...
@@ -276,7 +276,7 @@ describe API::Issues do
...
@@ -276,7 +276,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
assignee_ids:
[
user2
.
id
]
}
params:
{
assignee_ids:
[
user2
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'assignees'
].
first
[
'name'
]).
to
eq
(
user2
.
name
)
expect
(
json_response
[
'assignees'
].
first
[
'name'
]).
to
eq
(
user2
.
name
)
end
end
...
@@ -286,7 +286,7 @@ describe API::Issues do
...
@@ -286,7 +286,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
assignee_ids:
[
user2
.
id
,
guest
.
id
]
}
params:
{
assignee_ids:
[
user2
.
id
,
guest
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'assignees'
].
size
).
to
eq
(
1
)
expect
(
json_response
[
'assignees'
].
size
).
to
eq
(
1
)
end
end
...
@@ -300,7 +300,7 @@ describe API::Issues do
...
@@ -300,7 +300,7 @@ describe API::Issues do
it
'does not update labels if not present'
do
it
'does not update labels if not present'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
title:
'updated title'
}
params:
{
title:
'updated title'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
eq
([
label
.
title
])
expect
(
json_response
[
'labels'
]).
to
eq
([
label
.
title
])
end
end
...
@@ -309,7 +309,7 @@ describe API::Issues do
...
@@ -309,7 +309,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
''
}
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
''
}
end
end
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
eq
([])
expect
(
json_response
[
'labels'
]).
to
eq
([])
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
end
end
...
@@ -319,7 +319,7 @@ describe API::Issues do
...
@@ -319,7 +319,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
[
''
]
}
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
[
''
]
}
end
end
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
eq
([])
expect
(
json_response
[
'labels'
]).
to
eq
([])
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
end
end
...
@@ -329,7 +329,7 @@ describe API::Issues do
...
@@ -329,7 +329,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
'foo,bar'
}
params:
{
labels:
'foo,bar'
}
end
end
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
include
'foo'
expect
(
json_response
[
'labels'
]).
to
include
'foo'
expect
(
json_response
[
'labels'
]).
to
include
'bar'
expect
(
json_response
[
'labels'
]).
to
include
'bar'
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
...
@@ -340,7 +340,7 @@ describe API::Issues do
...
@@ -340,7 +340,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
%w(foo bar)
}
params:
{
labels:
%w(foo bar)
}
end
end
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
include
'foo'
expect
(
json_response
[
'labels'
]).
to
include
'foo'
expect
(
json_response
[
'labels'
]).
to
include
'bar'
expect
(
json_response
[
'labels'
]).
to
include
'bar'
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
expect
(
json_response
[
'updated_at'
]).
to
be
>
Time
.
now
...
@@ -377,7 +377,7 @@ describe API::Issues do
...
@@ -377,7 +377,7 @@ describe API::Issues do
it
'returns 400 if title is too long'
do
it
'returns 400 if title is too long'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
title:
'g'
*
256
}
params:
{
title:
'g'
*
256
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
][
'title'
]).
to
eq
([
expect
(
json_response
[
'message'
][
'title'
]).
to
eq
([
'is too long (maximum is 255 characters)'
'is too long (maximum is 255 characters)'
])
])
...
@@ -388,7 +388,7 @@ describe API::Issues do
...
@@ -388,7 +388,7 @@ describe API::Issues do
it
'updates a project issue'
do
it
'updates a project issue'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
'label2'
,
state_event:
'close'
}
params:
{
labels:
'label2'
,
state_event:
'close'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
include
'label2'
expect
(
json_response
[
'labels'
]).
to
include
'label2'
expect
(
json_response
[
'state'
]).
to
eq
'closed'
expect
(
json_response
[
'state'
]).
to
eq
'closed'
...
@@ -397,7 +397,7 @@ describe API::Issues do
...
@@ -397,7 +397,7 @@ describe API::Issues do
it
'reopens a project isssue'
do
it
'reopens a project isssue'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
closed_issue
.
iid
}
"
,
user
),
params:
{
state_event:
'reopen'
}
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
closed_issue
.
iid
}
"
,
user
),
params:
{
state_event:
'reopen'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'state'
]).
to
eq
'opened'
expect
(
json_response
[
'state'
]).
to
eq
'opened'
end
end
...
@@ -407,7 +407,7 @@ describe API::Issues do
...
@@ -407,7 +407,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
labels:
'label3'
,
state_event:
'close'
,
updated_at:
update_time
}
params:
{
labels:
'label3'
,
state_event:
'close'
,
updated_at:
update_time
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'labels'
]).
to
include
'label3'
expect
(
json_response
[
'labels'
]).
to
include
'label3'
expect
(
Time
.
parse
(
json_response
[
'updated_at'
])).
to
be_like_time
(
update_time
)
expect
(
Time
.
parse
(
json_response
[
'updated_at'
])).
to
be_like_time
(
update_time
)
end
end
...
@@ -420,7 +420,7 @@ describe API::Issues do
...
@@ -420,7 +420,7 @@ describe API::Issues do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
due_date:
due_date
}
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params:
{
due_date:
due_date
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'due_date'
]).
to
eq
(
due_date
)
expect
(
json_response
[
'due_date'
]).
to
eq
(
due_date
)
end
end
end
end
...
...
spec/requests/api/pages/pages_spec.rb
View file @
1d6bb047
...
@@ -32,7 +32,7 @@ describe API::Pages do
...
@@ -32,7 +32,7 @@ describe API::Pages do
it
'returns 204'
do
it
'returns 204'
do
delete
api
(
"/projects/
#{
project
.
id
}
/pages"
,
admin
)
delete
api
(
"/projects/
#{
project
.
id
}
/pages"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
it
'removes the pages'
do
it
'removes the pages'
do
...
@@ -53,7 +53,7 @@ describe API::Pages do
...
@@ -53,7 +53,7 @@ describe API::Pages do
it
'returns 204'
do
it
'returns 204'
do
delete
api
(
"/projects/
#{
project
.
id
}
/pages"
,
admin
)
delete
api
(
"/projects/
#{
project
.
id
}
/pages"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
end
end
...
@@ -63,7 +63,7 @@ describe API::Pages do
...
@@ -63,7 +63,7 @@ describe API::Pages do
delete
api
(
"/projects/
#{
id
}
/pages"
,
admin
)
delete
api
(
"/projects/
#{
id
}
/pages"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
...
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