Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
helm3
Commits
92db089c
Commit
92db089c
authored
Mar 19, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #410 from technosophos/fix/create-deployment-test
ifix(manager): test for create deployments
parents
e988ca1a
c52c6c54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
deployments_test.go
cmd/manager/deployments_test.go
+21
-0
No files found.
cmd/manager/deployments_test.go
View file @
92db089c
package
main
package
main
import
(
import
(
"bytes"
"encoding/json"
"net/http"
"net/http"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
...
@@ -28,6 +30,25 @@ func TestHealthz(t *testing.T) {
...
@@ -28,6 +30,25 @@ func TestHealthz(t *testing.T) {
// TODO: Get the body and check on the content type and the body.
// TODO: Get the body and check on the content type and the body.
}
}
func
TestCreateDeployments
(
t
*
testing
.
T
)
{
c
:=
stubContext
()
tpl
:=
&
common
.
Template
{
Name
:
"foo"
}
s
:=
httpHarness
(
c
,
"POST /deployments"
,
createDeploymentHandlerFunc
)
defer
s
.
Close
()
var
b
bytes
.
Buffer
if
err
:=
json
.
NewEncoder
(
&
b
)
.
Encode
(
tpl
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
res
,
err
:=
http
.
Post
(
s
.
URL
+
"/deployments"
,
"application/json"
,
&
b
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed POST: %s"
,
err
)
}
else
if
res
.
StatusCode
!=
http
.
StatusCreated
{
t
.
Errorf
(
"Expected status %d, got %d"
,
http
.
StatusCreated
,
res
.
StatusCode
)
}
}
// httpHarness is a simple test server fixture.
// httpHarness is a simple test server fixture.
// Simple fixture for standing up a test server with a single route.
// Simple fixture for standing up a test server with a single route.
//
//
...
...
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