Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
b95ccd06
Commit
b95ccd06
authored
Nov 05, 2015
by
Martin Sefcik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed testify and used standard Go testing approach
parent
7608e90b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
12 deletions
+31
-12
projects_test.go
projects_test.go
+31
-12
No files found.
projects_test.go
View file @
b95ccd06
package
gitlab
package
gitlab
import
(
import
(
"github.com/stretchr/testify/assert"
"testing"
"testing"
)
)
func
TestListAllProjects
(
t
*
testing
.
T
)
{
func
TestListAllProjects
(
t
*
testing
.
T
)
{
ts
,
client
:=
Stub
(
"stubs/projects/index.json"
)
ts
,
client
:=
Stub
(
"stubs/projects/index.json"
)
defer
ts
.
Close
()
opt
:=
&
ListProjectsOptions
{}
opt
:=
&
ListProjectsOptions
{}
projects
,
_
,
err
:=
client
.
Projects
.
ListAllProjects
(
opt
)
projects
,
_
,
err
:=
client
.
Projects
.
ListAllProjects
(
opt
)
assert
.
Equal
(
t
,
err
,
nil
)
if
err
!=
nil
{
assert
.
Equal
(
t
,
len
(
projects
),
2
)
t
.
Fatal
(
err
)
assert
.
Equal
(
t
,
projects
[
0
]
.
Name
,
"project"
)
}
assert
.
Equal
(
t
,
projects
[
1
]
.
Name
,
"project2"
)
defer
ts
.
Close
()
if
len
(
projects
)
!=
2
{
t
.
Fail
()
}
if
projects
[
0
]
.
Name
!=
"project"
{
t
.
Fail
()
}
if
projects
[
1
]
.
Name
!=
"project2"
{
t
.
Fail
()
}
}
}
func
TestGetProject
(
t
*
testing
.
T
)
{
func
TestGetProject
(
t
*
testing
.
T
)
{
ts
,
client
:=
Stub
(
"stubs/projects/show.json"
)
ts
,
client
:=
Stub
(
"stubs/projects/show.json"
)
defer
ts
.
Close
()
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
1
)
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
1
)
assert
.
Equal
(
t
,
err
,
nil
)
if
err
!=
nil
{
assert
.
Equal
(
t
,
project
.
Name
,
"project"
)
t
.
Fatal
(
err
)
assert
.
Equal
(
t
,
project
.
Namespace
.
Name
,
"group"
)
}
assert
.
Equal
(
t
,
project
.
Permissions
.
ProjectAccess
.
AccessLevel
,
MasterPermissions
)
assert
.
Nil
(
t
,
project
.
Permissions
.
GroupAccess
)
if
project
.
Name
!=
"project"
{
defer
ts
.
Close
()
t
.
Fail
()
}
if
project
.
Namespace
.
Name
!=
"group"
{
t
.
Fail
()
}
if
project
.
Permissions
.
ProjectAccess
.
AccessLevel
!=
MasterPermissions
{
t
.
Fail
()
}
if
project
.
Permissions
.
GroupAccess
!=
nil
{
t
.
Fail
()
}
}
}
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