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
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-workhorse
Commits
2806fe81
Commit
2806fe81
authored
Aug 23, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use separate test file
parent
08ec1011
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
37 deletions
+42
-37
backend_test.go
backend_test.go
+42
-0
main_test.go
main_test.go
+0
-37
No files found.
backend_test.go
0 → 100644
View file @
2806fe81
package
main
import
(
"testing"
)
func
TestParseAuthBackend
(
t
*
testing
.
T
)
{
failures
:=
[]
string
{
""
,
"ftp://localhost"
,
"https://example.com"
,
}
for
_
,
example
:=
range
failures
{
if
_
,
err
:=
parseAuthBackend
(
example
);
err
==
nil
{
t
.
Errorf
(
"error expected for %q"
,
example
)
}
}
successes
:=
[]
struct
{
input
,
host
,
scheme
string
}{
{
"http://localhost:8080"
,
"localhost:8080"
,
"http"
},
{
"localhost:3000"
,
"localhost:3000"
,
"http"
},
{
"http://localhost"
,
"localhost"
,
"http"
},
{
"localhost"
,
"localhost"
,
"http"
},
}
for
_
,
example
:=
range
successes
{
result
,
err
:=
parseAuthBackend
(
example
.
input
)
if
err
!=
nil
{
t
.
Errorf
(
"parse %q: %v"
,
example
.
input
,
err
)
break
}
if
result
.
Host
!=
example
.
host
{
t
.
Errorf
(
"expected %q, got %q"
,
example
.
host
,
result
.
Host
)
}
if
result
.
Scheme
!=
example
.
scheme
{
t
.
Errorf
(
"expected %q, got %q"
,
example
.
scheme
,
result
.
Scheme
)
}
}
}
main_test.go
View file @
2806fe81
...
...
@@ -736,43 +736,6 @@ func TestGetGitPatch(t *testing.T) {
}
}
func
TestParseAuthBackend
(
t
*
testing
.
T
)
{
failures
:=
[]
string
{
""
,
"ftp://localhost"
,
"https://example.com"
,
}
for
_
,
example
:=
range
failures
{
if
_
,
err
:=
parseAuthBackend
(
example
);
err
==
nil
{
t
.
Errorf
(
"error expected for %q"
,
example
)
}
}
successes
:=
[]
struct
{
input
,
host
,
scheme
string
}{
{
"http://localhost:8080"
,
"localhost:8080"
,
"http"
},
{
"localhost:3000"
,
"localhost:3000"
,
"http"
},
{
"http://localhost"
,
"localhost"
,
"http"
},
{
"localhost"
,
"localhost"
,
"http"
},
}
for
_
,
example
:=
range
successes
{
result
,
err
:=
parseAuthBackend
(
example
.
input
)
if
err
!=
nil
{
t
.
Errorf
(
"parse %q: %v"
,
example
.
input
,
err
)
break
}
if
result
.
Host
!=
example
.
host
{
t
.
Errorf
(
"expected %q, got %q"
,
example
.
host
,
result
.
Host
)
}
if
result
.
Scheme
!=
example
.
scheme
{
t
.
Errorf
(
"expected %q, got %q"
,
example
.
scheme
,
result
.
Scheme
)
}
}
}
func
setupStaticFile
(
fpath
,
content
string
)
error
{
cwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
...
...
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