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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
18 deletions
+34
-18
projects_test.go
projects_test.go
+32
-14
index.json
stubs/projects/index.json
+1
-2
show.json
stubs/projects/show.json
+1
-2
No files found.
projects_test.go
View file @
b95ccd06
package
gitlab
import
(
"github.com/stretchr/testify/assert"
"testing"
)
func
TestListAllProjects
(
t
*
testing
.
T
)
{
ts
,
client
:=
Stub
(
"stubs/projects/index.json"
)
defer
ts
.
Close
()
opt
:=
&
ListProjectsOptions
{}
projects
,
_
,
err
:=
client
.
Projects
.
ListAllProjects
(
opt
)
assert
.
Equal
(
t
,
err
,
nil
)
assert
.
Equal
(
t
,
len
(
projects
),
2
)
assert
.
Equal
(
t
,
projects
[
0
]
.
Name
,
"project"
)
assert
.
Equal
(
t
,
projects
[
1
]
.
Name
,
"project2"
)
defer
ts
.
Close
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
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
)
{
ts
,
client
:=
Stub
(
"stubs/projects/show.json"
)
defer
ts
.
Close
()
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
1
)
assert
.
Equal
(
t
,
err
,
nil
)
assert
.
Equal
(
t
,
project
.
Name
,
"project"
)
assert
.
Equal
(
t
,
project
.
Namespace
.
Name
,
"group"
)
assert
.
Equal
(
t
,
project
.
Permissions
.
ProjectAccess
.
AccessLevel
,
MasterPermissions
)
assert
.
Nil
(
t
,
project
.
Permissions
.
GroupAccess
)
defer
ts
.
Close
()
}
\ No newline at end of file
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
project
.
Name
!=
"project"
{
t
.
Fail
()
}
if
project
.
Namespace
.
Name
!=
"group"
{
t
.
Fail
()
}
if
project
.
Permissions
.
ProjectAccess
.
AccessLevel
!=
MasterPermissions
{
t
.
Fail
()
}
if
project
.
Permissions
.
GroupAccess
!=
nil
{
t
.
Fail
()
}
}
stubs/projects/index.json
View file @
b95ccd06
...
...
@@ -81,4 +81,4 @@
"star_count"
:
0
,
"forks_count"
:
0
}
]
\ No newline at end of file
]
stubs/projects/show.json
View file @
b95ccd06
...
...
@@ -48,4 +48,4 @@
},
"group_access"
:
null
}
}
\ No newline at end of file
}
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