Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
0
Merge Requests
0
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-shell
Commits
a012d24e
Commit
a012d24e
authored
Jun 27, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure rm-key works with only ID
parent
f980d8f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+17
-0
No files found.
spec/gitlab_keys_spec.rb
View file @
a012d24e
...
...
@@ -177,6 +177,23 @@ describe GitlabKeys do
gitlab_keys
.
send
(
:rm_key
).
should
be_true
end
end
context
'without key content'
do
let
(
:gitlab_keys
)
{
build_gitlab_keys
(
'rm-key'
,
'key-741'
)
}
it
"removes the right line by key ID"
do
create_authorized_keys_fixture
other_line
=
"command=
\"
#{
ROOT_PATH
}
/bin/gitlab-shell key-742
\"
,options ssh-rsa AAAAB3NzaDAxx2E"
delete_line
=
"command=
\"
#{
ROOT_PATH
}
/bin/gitlab-shell key-741
\"
,options ssh-rsa AAAAB3NzaDAxx2E"
open
(
tmp_authorized_keys_path
,
'a'
)
do
|
auth_file
|
auth_file
.
puts
delete_line
auth_file
.
puts
other_line
end
gitlab_keys
.
send
:rm_key
erased_line
=
delete_line
.
gsub
(
/./
,
'#'
)
File
.
read
(
tmp_authorized_keys_path
).
should
==
"existing content
\n
#{
erased_line
}
\n
#{
other_line
}
\n
"
end
end
end
describe
:clear
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment