コード例 #1
0
ファイル: client_test.go プロジェクト: rupakg/panamaxcli
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)
}
コード例 #2
0
ファイル: client_test.go プロジェクト: rupakg/panamaxcli
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)
}