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
6f13b582
Commit
6f13b582
authored
Jan 08, 2019
by
Michael Cook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go fmt
parent
92d67d22
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
19 deletions
+17
-19
environments.go
environments.go
+1
-2
environments_test.go
environments_test.go
+14
-15
issues_test.go
issues_test.go
+1
-1
tags_test.go
tags_test.go
+1
-1
No files found.
environments.go
View file @
6f13b582
...
...
@@ -182,4 +182,4 @@ func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int
}
return
s
.
client
.
Do
(
req
,
nil
)
}
\ No newline at end of file
}
environments_test.go
View file @
6f13b582
...
...
@@ -14,16 +14,16 @@ func TestListEnvironments(t *testing.T) {
mux
.
HandleFunc
(
"/api/v4/projects/1/environments"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"GET"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments?page=1&per_page=10"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments?page=1&per_page=10"
)
fmt
.
Fprint
(
w
,
`[{"id": 1,"name": "review/fix-foo", "slug": "review-fix-foo-dfjre3", "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com"}]`
)
})
envs
,
_
,
err
:=
client
.
Environments
.
ListEnvironments
(
1
,
&
ListEnvironmentsOptions
{
Page
:
1
,
PerPage
:
10
})
envs
,
_
,
err
:=
client
.
Environments
.
ListEnvironments
(
1
,
&
ListEnvironmentsOptions
{
Page
:
1
,
PerPage
:
10
})
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
want
:=
[]
*
Environment
{{
ID
:
1
,
Name
:
"review/fix-foo"
,
Slug
:
"review-fix-foo-dfjre3"
,
ExternalURL
:
"https://review-fix-foo-dfjre3.example.gitlab.com"
}}
want
:=
[]
*
Environment
{{
ID
:
1
,
Name
:
"review/fix-foo"
,
Slug
:
"review-fix-foo-dfjre3"
,
ExternalURL
:
"https://review-fix-foo-dfjre3.example.gitlab.com"
}}
if
!
reflect
.
DeepEqual
(
want
,
envs
)
{
t
.
Errorf
(
"Environments.ListEnvironments returned %+v, want %+v"
,
envs
,
want
)
}
...
...
@@ -35,16 +35,16 @@ func TestCreateEnvironment(t *testing.T) {
mux
.
HandleFunc
(
"/api/v4/projects/1/environments"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"POST"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments"
)
fmt
.
Fprint
(
w
,
`{"id": 1,"name": "deploy", "slug": "deploy", "external_url": "https://deploy.example.gitlab.com"}`
)
})
envs
,
_
,
err
:=
client
.
Environments
.
CreateEnvironment
(
1
,
&
CreateEnvironmentOptions
{
Name
:
String
(
"deploy"
),
ExternalURL
:
String
(
"https://deploy.example.gitlab.com"
)})
envs
,
_
,
err
:=
client
.
Environments
.
CreateEnvironment
(
1
,
&
CreateEnvironmentOptions
{
Name
:
String
(
"deploy"
),
ExternalURL
:
String
(
"https://deploy.example.gitlab.com"
)})
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
want
:=
&
Environment
{
ID
:
1
,
Name
:
"deploy"
,
Slug
:
"deploy"
,
ExternalURL
:
"https://deploy.example.gitlab.com"
}
want
:=
&
Environment
{
ID
:
1
,
Name
:
"deploy"
,
Slug
:
"deploy"
,
ExternalURL
:
"https://deploy.example.gitlab.com"
}
if
!
reflect
.
DeepEqual
(
want
,
envs
)
{
t
.
Errorf
(
"Environments.CreateEnvironment returned %+v, want %+v"
,
envs
,
want
)
}
...
...
@@ -56,16 +56,16 @@ func TestEditEnvironment(t *testing.T) {
mux
.
HandleFunc
(
"/api/v4/projects/1/environments/1"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"PUT"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments/1"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments/1"
)
fmt
.
Fprint
(
w
,
`{"id": 1,"name": "staging", "slug": "staging", "external_url": "https://staging.example.gitlab.com"}`
)
})
envs
,
_
,
err
:=
client
.
Environments
.
EditEnvironment
(
1
,
1
,
&
EditEnvironmentOptions
{
Name
:
String
(
"staging"
),
ExternalURL
:
String
(
"https://staging.example.gitlab.com"
)})
envs
,
_
,
err
:=
client
.
Environments
.
EditEnvironment
(
1
,
1
,
&
EditEnvironmentOptions
{
Name
:
String
(
"staging"
),
ExternalURL
:
String
(
"https://staging.example.gitlab.com"
)})
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
want
:=
&
Environment
{
ID
:
1
,
Name
:
"staging"
,
Slug
:
"staging"
,
ExternalURL
:
"https://staging.example.gitlab.com"
}
want
:=
&
Environment
{
ID
:
1
,
Name
:
"staging"
,
Slug
:
"staging"
,
ExternalURL
:
"https://staging.example.gitlab.com"
}
if
!
reflect
.
DeepEqual
(
want
,
envs
)
{
t
.
Errorf
(
"Environments.EditEnvironment returned %+v, want %+v"
,
envs
,
want
)
}
...
...
@@ -77,9 +77,9 @@ func TestDeleteEnvironment(t *testing.T) {
mux
.
HandleFunc
(
"/api/v4/projects/1/environments/1"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"DELETE"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments/1"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments/1"
)
})
_
,
err
:=
client
.
Environments
.
DeleteEnvironment
(
1
,
1
)
_
,
err
:=
client
.
Environments
.
DeleteEnvironment
(
1
,
1
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
@@ -91,10 +91,10 @@ func TestStopEnvironment(t *testing.T) {
mux
.
HandleFunc
(
"/api/v4/projects/1/environments/1/stop"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"POST"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments/1/stop"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/environments/1/stop"
)
})
_
,
err
:=
client
.
Environments
.
StopEnvironment
(
1
,
1
)
_
,
err
:=
client
.
Environments
.
StopEnvironment
(
1
,
1
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
}
\ No newline at end of file
}
issues_test.go
View file @
6f13b582
...
...
@@ -272,7 +272,7 @@ func TestListMergeRequestsClosingIssue(t *testing.T) {
mux
.
HandleFunc
(
"/api/v4/projects/1/issues/5/closed_by"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"GET"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/issues/5/closed_by?page=1&per_page=10"
)
testURL
(
t
,
r
,
"/api/v4/projects/1/issues/5/closed_by?page=1&per_page=10"
)
fmt
.
Fprint
(
w
,
`[{"id":1, "title" : "test merge one"},{"id":2, "title" : "test merge two"}]`
)
})
...
...
tags_test.go
View file @
6f13b582
...
...
@@ -16,7 +16,7 @@ func TestListTags(t *testing.T) {
fmt
.
Fprint
(
w
,
`[{"name": "1.0.0"},{"name": "1.0.1"}]`
)
})
opt
:=
&
ListTagsOptions
{
ListOptions
:
ListOptions
{
Page
:
2
,
PerPage
:
3
}}
opt
:=
&
ListTagsOptions
{
ListOptions
:
ListOptions
{
Page
:
2
,
PerPage
:
3
}}
tags
,
_
,
err
:=
client
.
Tags
.
ListTags
(
1
,
opt
)
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