Beispiel #1
0
func TestDeleteDeployment(t *testing.T) {
	setup()
	defer teardown()
	fakeManager := FakeManager{}
	handlerCalled := false
	handler := func(w http.ResponseWriter, r *http.Request) {
		handlerCalled = true
		api.ReDeploy(&fakeManager, w, r)
	}
	router.Methods("DELETE").Path(api.URLForDeploymentID("{id}")).Name("test").HandlerFunc(handler)

	err := client.DeleteDeployment("1")
	assert.NoError(t, err)
	assert.True(t, handlerCalled)
}
Beispiel #2
0
func TestDescribeDeployment(t *testing.T) {
	setup()
	defer teardown()
	dr := agent.DeploymentResponseFull{ID: 1, Name: "Test"}
	fakeManager := FakeManager{Deployment: dr}
	handlerCalled := false
	handler := func(w http.ResponseWriter, r *http.Request) {
		handlerCalled = true
		api.ShowDeployment(&fakeManager, w, r)
	}
	router.Methods("GET").Path(api.URLForDeploymentID("{id}")).Name("test").HandlerFunc(handler)

	d, err := client.DescribeDeployment("1")
	assert.NoError(t, err)
	assert.Equal(t, "Test", d.Name)
	assert.True(t, handlerCalled)
}
Beispiel #3
0
// DeleteDeployment deletes a specific deployment.
func (c APIClient) DeleteDeployment(id string) error {
	return c.doRequest("DELETE", api.URLForDeploymentID(id), nil, nil)
}
Beispiel #4
0
// DescribeDeployment fetches details for a specific deployment.
func (c APIClient) DescribeDeployment(id string) (agent.DeploymentResponseFull, error) {
	var resp agent.DeploymentResponseFull
	err := c.doRequest("GET", api.URLForDeploymentID(id), &resp, nil)
	return resp, err
}