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
Kazuhiko Shiozaki
gitlab-shell
Commits
2b01b84f
Commit
2b01b84f
authored
Feb 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitlab-keys with tests
parent
ea6ea902
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
bin/gitlab-keys
bin/gitlab-keys
+1
-0
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+47
-0
spec/gitlab_shell_spec.rb
spec/gitlab_shell_spec.rb
+0
-1
No files found.
bin/gitlab-keys
View file @
2b01b84f
...
...
@@ -6,6 +6,7 @@
# Ex.
# /bin/gitlab-keys add-key dzaporozhets "ssh-rsa AAAAx321..."
#
# /bin/gitlab-keys rm-key dzaporozhets "ssh-rsa AAAAx321..."
#
ROOT_PATH
=
File
.
join
(
File
.
expand_path
(
File
.
dirname
(
__FILE__
)),
".."
)
require
File
.
join
(
ROOT_PATH
,
'lib'
,
'gitlab_keys'
)
...
...
spec/gitlab_keys_spec.rb
0 → 100644
View file @
2b01b84f
require_relative
'spec_helper'
require_relative
'../lib/gitlab_keys'
describe
GitlabKeys
do
describe
:initialize
do
before
do
argv
(
'add-key'
,
'dzaporozhets'
,
'ssh-rsa AAAAB3NzaDAxx2E'
)
@gl_keys
=
GitlabKeys
.
new
end
it
{
@gl_keys
.
username
.
should
==
'dzaporozhets'
}
it
{
@gl_keys
.
key
.
should
==
'ssh-rsa AAAAB3NzaDAxx2E'
}
it
{
@gl_keys
.
instance_variable_get
(
:@command
).
should
==
'add-key'
}
end
describe
:add_key
do
before
do
argv
(
'add-key'
,
'dzaporozhets'
,
'ssh-rsa AAAAB3NzaDAxx2E'
)
@gl_keys
=
GitlabKeys
.
new
end
it
"should receive valid cmd"
do
valid_cmd
=
"echo 'command=
\"
/home/git/gitlab-shell/spec/../bin/gitlab-shell dzaporozhets
\"
,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaDAxx2E' >> /home/git/.ssh/authorized_keys"
@gl_keys
.
should_receive
(
:system
).
with
(
valid_cmd
)
@gl_keys
.
send
:add_key
end
end
describe
:rm_key
do
before
do
argv
(
'rm-key'
,
'dzaporozhets'
,
'ssh-rsa AAAAB3NzaDAxx2E'
)
@gl_keys
=
GitlabKeys
.
new
end
it
"should receive valid cmd"
do
valid_cmd
=
"sed '/ssh-rsa AAAAB3NzaDAxx2E/d' /home/git/.ssh/authorized_keys"
@gl_keys
.
should_receive
(
:system
).
with
(
valid_cmd
)
@gl_keys
.
send
:rm_key
end
end
def
argv
(
*
args
)
args
.
each_with_index
do
|
arg
,
i
|
ARGV
[
i
]
=
arg
end
end
end
spec/gitlab_shell_spec.rb
View file @
2b01b84f
...
...
@@ -2,7 +2,6 @@ require_relative 'spec_helper'
require_relative
'../lib/gitlab_shell'
describe
GitlabShell
do
describe
:initialize
do
before
do
ssh_cmd
'git-receive-pack'
...
...
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