Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
76e771f7
Commit
76e771f7
authored
Aug 01, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'denied clone' test
parent
5d3d5373
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
main_test.go
main_test.go
+25
-0
No files found.
main_test.go
View file @
76e771f7
...
...
@@ -45,6 +45,31 @@ func TestAllowedClone(t *testing.T) {
runOrFail
(
t
,
cloneCmd
)
}
func
TestDeniedClone
(
t
*
testing
.
T
)
{
// Prepare clone directory
if
err
:=
os
.
RemoveAll
(
scratchDir
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Prepare test server and backend
ts
:=
testAuthServer
(
403
,
"Denied"
)
defer
ts
.
Close
()
cmd
,
err
:=
startServer
(
ts
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
cleanUpProcessGroup
(
cmd
)
if
err
:=
waitServer
();
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Do the git clone
cloneCmd
:=
exec
.
Command
(
"git"
,
"clone"
,
remote
,
path
.
Join
(
scratchDir
,
"test"
))
if
err
:=
cloneCmd
.
Run
();
err
==
nil
{
t
.
Fatal
(
"git clone should have failed"
)
}
}
func
TestAllowedPush
(
t
*
testing
.
T
)
{
// Prepare the repo to push from
checkoutDir
:=
path
.
Join
(
scratchDir
,
"test"
)
...
...
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