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
879d1d26
Commit
879d1d26
authored
Apr 01, 2021
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add authorization test
Test for auth on the project jobs resolver.
parent
f07be71b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-1
spec/graphql/resolvers/project_jobs_resolver_spec.rb
spec/graphql/resolvers/project_jobs_resolver_spec.rb
+23
-11
No files found.
doc/api/graphql/reference/index.md
View file @
879d1d26
...
...
@@ -4771,7 +4771,7 @@ An edge in a connection.
|
`iterations`
|
[
`IterationConnection`
](
#iterationconnection
)
| Find iterations. |
|
`jiraImportStatus`
|
[
`String`
](
#string
)
| Status of Jira import background job of the project. |
|
`jiraImports`
|
[
`JiraImportConnection`
](
#jiraimportconnection
)
| Jira imports into the project. |
|
`jobs`
|
[
`CiJobConnection`
](
#cijobconnection
)
| Jobs of a
project, only jobs of a single project can be requested at a time
. |
|
`jobs`
|
[
`CiJobConnection`
](
#cijobconnection
)
| Jobs of a
single project
. |
|
`jobsEnabled`
|
[
`Boolean`
](
#boolean
)
| Indicates if CI/CD pipeline jobs are enabled for the current user. |
|
`label`
|
[
`Label`
](
#label
)
| A label available on this project. |
|
`labels`
|
[
`LabelConnection`
](
#labelconnection
)
| Labels available on this project. |
...
...
spec/graphql/resolvers/project_jobs_resolver_spec.rb
View file @
879d1d26
...
...
@@ -5,29 +5,41 @@ require 'spec_helper'
RSpec
.
describe
Resolvers
::
ProjectJobsResolver
do
include
GraphqlHelpers
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
let_it_be
(
:irrelevant_project
)
{
create
(
:project
,
:repository
,
:public
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:irrelevant_project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let_it_be
(
:irrelevant_pipeline
)
{
create
(
:ci_pipeline
,
project:
irrelevant_project
)
}
let_it_be
(
:build_one
)
{
create
(
:ci_build
,
:success
,
name:
'Build One'
,
pipeline:
pipeline
)
}
let_it_be
(
:build_two
)
{
create
(
:ci_build
,
:success
,
name:
'Build Two'
,
pipeline:
pipeline
)
}
let_it_be
(
:build_three
)
{
create
(
:ci_build
,
:failed
,
name:
'Build Three'
,
pipeline:
pipeline
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:build_one
)
{
create
(
:ci_build
,
:success
,
name:
'Build One'
,
pipeline:
pipeline
)
}
let
(
:build_two
)
{
create
(
:ci_build
,
:success
,
name:
'Build Two'
,
pipeline:
pipeline
)
}
let
(
:build_three
)
{
create
(
:ci_build
,
:failed
,
name:
'Build Three'
,
pipeline:
pipeline
)
}
let
(
:irrelevant_build
)
{
create
(
:ci_build
,
name:
'Irrelevant Build'
,
pipeline:
irrelevant_pipeline
)}
let
(
:args
)
{
{}
}
let
(
:current_user
)
{
create
(
:user
)
}
subject
{
resolve_jobs
(
args
)
}
describe
'#resolve'
do
context
'with statuses argument'
do
let
(
:args
)
{
{
statuses:
[
Types
::
Ci
::
JobStatusEnum
.
coerce_isolated_input
(
'SUCCESS'
)]
}
}
context
'with authorized user'
do
before
do
project
.
add_developer
(
current_user
)
end
context
'with statuses argument'
do
let
(
:args
)
{
{
statuses:
[
Types
::
Ci
::
JobStatusEnum
.
coerce_isolated_input
(
'SUCCESS'
)]
}
}
it
{
is_expected
.
to
contain_exactly
(
build_one
,
build_two
)
}
it
{
is_expected
.
to
contain_exactly
(
build_one
,
build_two
)
}
end
context
'without statuses argument'
do
it
{
is_expected
.
to
contain_exactly
(
build_one
,
build_two
,
build_three
)
}
end
end
context
'without statuses argument'
do
it
{
is_expected
.
to
contain_exactly
(
build_one
,
build_two
,
build_three
)
}
context
'with unauthorized user'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_nil
}
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