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
25a9f1a8
Commit
25a9f1a8
authored
Feb 21, 2019
by
Sindre Paulsrud Moe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing test
parent
b704221d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
10 deletions
+46
-10
projects_test.go
projects_test.go
+46
-10
No files found.
projects_test.go
View file @
25a9f1a8
...
...
@@ -194,7 +194,7 @@ func TestGetProjectByID(t *testing.T) {
})
want
:=
&
Project
{
ID
:
1
}
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
1
)
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
1
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"Projects.GetProject returns an error: %v"
,
err
)
}
...
...
@@ -215,7 +215,43 @@ func TestGetProjectByName(t *testing.T) {
})
want
:=
&
Project
{
ID
:
1
}
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
"namespace/name"
)
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
"namespace/name"
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"Projects.GetProject returns an error: %v"
,
err
)
}
if
!
reflect
.
DeepEqual
(
want
,
project
)
{
t
.
Errorf
(
"Projects.GetProject returned %+v, want %+v"
,
project
,
want
)
}
}
func
TestGetProjectWithOptions
(
t
*
testing
.
T
)
{
mux
,
server
,
client
:=
setup
()
defer
teardown
(
server
)
mux
.
HandleFunc
(
"/api/v4/projects/1"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"GET"
)
fmt
.
Fprint
(
w
,
`{
"id":1,
"statistics": {
"commit_count": 37,
"storage_size": 1038090,
"repository_size": 1038090,
"lfs_objects_size": 0,
"job_artifacts_size": 0
}}`
)
})
want
:=
&
Project
{
ID
:
1
,
Statistics
:
&
ProjectStatistics
{
CommitCount
:
37
,
StorageStatistics
:
StorageStatistics
{
StorageSize
:
1038090
,
RepositorySize
:
1038090
,
LfsObjectsSize
:
0
,
JobArtifactsSize
:
0
,
},
}}
project
,
_
,
err
:=
client
.
Projects
.
GetProject
(
1
,
&
GetProjectOptions
{
Statistics
:
Bool
(
true
)})
if
err
!=
nil
{
t
.
Fatalf
(
"Projects.GetProject returns an error: %v"
,
err
)
}
...
...
@@ -373,10 +409,10 @@ func TestGetApprovalConfiguration(t *testing.T) {
}
want
:=
&
ProjectApprovals
{
Approvers
:
[]
*
MergeRequestApproverUser
{},
ApproverGroups
:
[]
*
MergeRequestApproverGroup
{},
ApprovalsBeforeMerge
:
3
,
ResetApprovalsOnPush
:
false
,
Approvers
:
[]
*
MergeRequestApproverUser
{},
ApproverGroups
:
[]
*
MergeRequestApproverGroup
{},
ApprovalsBeforeMerge
:
3
,
ResetApprovalsOnPush
:
false
,
DisableOverridingApproversPerMergeRequest
:
false
,
}
...
...
@@ -411,10 +447,10 @@ func TestChangeApprovalConfiguration(t *testing.T) {
}
want
:=
&
ProjectApprovals
{
Approvers
:
[]
*
MergeRequestApproverUser
{},
ApproverGroups
:
[]
*
MergeRequestApproverGroup
{},
ApprovalsBeforeMerge
:
3
,
ResetApprovalsOnPush
:
false
,
Approvers
:
[]
*
MergeRequestApproverUser
{},
ApproverGroups
:
[]
*
MergeRequestApproverGroup
{},
ApprovalsBeforeMerge
:
3
,
ResetApprovalsOnPush
:
false
,
DisableOverridingApproversPerMergeRequest
:
false
,
}
...
...
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