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
68f98f58
Commit
68f98f58
authored
Mar 02, 2021
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply review suggestions
parent
d1c97fc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
spec/requests/api/resource_access_tokens_spec.rb
spec/requests/api/resource_access_tokens_spec.rb
+5
-5
No files found.
spec/requests/api/resource_access_tokens_spec.rb
View file @
68f98f58
...
...
@@ -39,7 +39,7 @@ RSpec.describe API::ResourceAccessTokens do
expect
(
api_get_token
[
"name"
]).
to
eq
(
token
.
name
)
expect
(
api_get_token
[
"scopes"
]).
to
eq
(
token
.
scopes
)
expect
(
api_get_token
[
"expires_at"
]).
to
eq
(
token
.
expires_at
.
to_date
.
iso8601
)
expect
(
api_get_token
[
"token"
]).
to
be_nil
expect
(
api_get_token
).
not_to
have_key
(
'token'
)
end
context
"when using a project access token to GET other project access tokens"
do
...
...
@@ -194,13 +194,13 @@ RSpec.describe API::ResourceAccessTokens do
end
describe
"POST projects/:id/access_tokens"
do
let_it_be
(
:params
)
{
{
name:
"test"
,
scopes:
[
"api"
],
expires_at:
Date
.
today
+
1
.
month
}
}
let
(
:params
)
{
{
name:
"test"
,
scopes:
[
"api"
],
expires_at:
expires_at
}
}
let
(
:expires_at
)
{
1
.
month
.
from_now
}
subject
(
:create_token
)
{
post
api
(
"/projects/
#{
project_id
}
/access_tokens"
,
user
),
params:
params
}
context
"when the user has maintainer permissions"
do
let_it_be
(
:project_id
)
{
project
.
id
}
let_it_be
(
:expires_at
)
{
1
.
month
.
from_now
}
before
do
project
.
add_maintainer
(
user
)
...
...
@@ -215,12 +215,12 @@ RSpec.describe API::ResourceAccessTokens do
expect
(
json_response
[
"name"
]).
to
eq
(
"test"
)
expect
(
json_response
[
"scopes"
]).
to
eq
([
"api"
])
expect
(
json_response
[
"expires_at"
]).
to
eq
(
expires_at
.
to_date
.
iso8601
)
expect
(
json_response
[
"token"
]).
not_to
be_nil
expect
(
json_response
[
"token"
]).
to
be_present
end
end
context
"when 'expires_at' is not set"
do
let
_it_be
(
:params
)
{
{
name:
"test"
,
scopes:
[
"api"
]
}
}
let
(
:expires_at
)
{
nil
}
it
"creates a project access token with the params"
,
:aggregate_failures
do
create_token
...
...
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