Пример #1
0
func TestRedeployDeployment(t *testing.T) {
	setup()
	defer teardown()
	dr := agent.DeploymentResponseLite{Name: "Test"}
	fakeManager := FakeManager{Redeployment: dr}
	handlerCalled := false
	handler := func(w http.ResponseWriter, r *http.Request) {
		handlerCalled = true
		api.ReDeploy(&fakeManager, w, r)
	}
	router.Methods("POST").Path(api.RedeploymentURLForDeploymentID("{id}")).Name("test").HandlerFunc(handler)

	d, err := client.RedeployDeployment("1")
	assert.NoError(t, err)
	assert.Equal(t, "Test", d.Name)
	assert.True(t, handlerCalled)
}
Пример #2
0
// RedeployDeployment redeploys a specific deployment.
func (c APIClient) RedeployDeployment(id string) (agent.DeploymentResponseLite, error) {
	var deployment agent.DeploymentResponseLite
	err := c.doRequest("POST", api.RedeploymentURLForDeploymentID(id), &deployment, nil)
	return deployment, err
}