Esempio n. 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)
}
Esempio n. 2
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)
}