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
f0166434
Commit
f0166434
authored
May 19, 2019
by
Pablo Carranza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting, add test
parent
3ee60e77
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
projects.go
projects.go
+2
-2
projects_test.go
projects_test.go
+29
-0
No files found.
projects.go
View file @
f0166434
...
...
@@ -562,8 +562,8 @@ func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions,
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#fork-project
type
ForkProjectOptions
struct
{
Namespace
*
string
`url:"namespace,omitempty" json:"namespace,omitempty"`
Name
*
string
`url:"name,omitempty" json:"name,omitempty" `
Path
*
string
`url:"path,omitempty" json:"path,omitempty"`
Name
*
string
`url:"name,omitempty" json:"name,omitempty" `
Path
*
string
`url:"path,omitempty" json:"path,omitempty"`
}
// ForkProject forks a project into the user namespace of the authenticated
...
...
projects_test.go
View file @
f0166434
...
...
@@ -522,3 +522,32 @@ func TestChangeAllowedApprovers(t *testing.T) {
t
.
Errorf
(
"Projects.ChangeAllowedApprovers returned %+v, want %+v"
,
approvals
,
want
)
}
}
func
TestForkProject
(
t
*
testing
.
T
)
{
mux
,
server
,
client
:=
setup
()
defer
teardown
(
server
)
namespace
:=
"mynamespace"
name
:=
"myreponame"
path
:=
"myrepopath"
mux
.
HandleFunc
(
"/api/v4/projects/1/fork"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"POST"
)
testBody
(
t
,
r
,
fmt
.
Sprintf
(
`{"namespace":"%s","name":"%s","path":"%s"}`
,
namespace
,
name
,
path
))
fmt
.
Fprint
(
w
,
`{"id":2}`
)
})
project
,
_
,
err
:=
client
.
Projects
.
ForkProject
(
1
,
&
ForkProjectOptions
{
Namespace
:
&
namespace
,
Name
:
&
name
,
Path
:
&
path
,
})
if
err
!=
nil
{
t
.
Errorf
(
"Projects.ForkProject returned error: %v"
,
err
)
}
want
:=
&
Project
{
ID
:
2
}
if
!
reflect
.
DeepEqual
(
want
,
project
)
{
t
.
Errorf
(
"Projects.ForProject returned %+v, want %+v"
,
project
,
want
)
}
}
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