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
0833f49b
Commit
0833f49b
authored
Jun 28, 2021
by
Andrew Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for prefilling Personal Access Token name and scopes
parent
cab35ea0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
spec/controllers/profiles/personal_access_tokens_controller_spec.rb
...ollers/profiles/personal_access_tokens_controller_spec.rb
+12
-0
spec/features/profiles/personal_access_tokens_spec.rb
spec/features/profiles/personal_access_tokens_spec.rb
+11
-0
No files found.
spec/controllers/profiles/personal_access_tokens_controller_spec.rb
View file @
0833f49b
...
@@ -64,5 +64,17 @@ RSpec.describe Profiles::PersonalAccessTokensController do
...
@@ -64,5 +64,17 @@ RSpec.describe Profiles::PersonalAccessTokensController do
it
"retrieves newly created personal access token value"
do
it
"retrieves newly created personal access token value"
do
expect
(
assigns
(
:new_personal_access_token
)).
to
eql
(
token_value
)
expect
(
assigns
(
:new_personal_access_token
)).
to
eql
(
token_value
)
end
end
it
"sets PAT name and scopes"
do
name
=
'My PAT'
scopes
=
'api,read_user'
get
:index
,
params:
{
name:
name
,
scopes:
scopes
}
expect
(
assigns
(
:personal_access_token
)).
to
have_attributes
(
name:
eq
(
name
),
scopes:
contain_exactly
(
:api
,
:read_user
)
)
end
end
end
end
end
spec/features/profiles/personal_access_tokens_spec.rb
View file @
0833f49b
...
@@ -149,4 +149,15 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
...
@@ -149,4 +149,15 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
personalAccessTokensScopedToProjects:
true
)
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
personalAccessTokensScopedToProjects:
true
)
end
end
it
"prefills token details"
do
name
=
'My PAT'
scopes
=
'api,read_user'
visit
profile_personal_access_tokens_path
({
name:
name
,
scopes:
scopes
})
expect
(
page
).
to
have_field
(
"Token name"
,
with:
name
)
expect
(
find
(
"#personal_access_token_scopes_api"
)).
to
be_checked
expect
(
find
(
"#personal_access_token_scopes_read_user"
)).
to
be_checked
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