예제 #1
0
func TestAddResponse(t *testing.T) {
	mb, err := mailbox.Create("tests.AddResponses")
	if err != nil {
		t.Fatal(err)
	}
	key := mailbox.AccessKey{FullAccess: true}
	key.Create()
	if err != nil {
		t.Fatal(err)
	}
	dep := mailbox.Deployment{MessageBody: "test", DeployedBy: key.Name}
	err = dep.Create()
	if err != nil {
		t.Fatal(err)
	}
	msg, err := mb.DeployMessage(dep.Id)
	if err != nil {
		t.Fatal(err)
	}
	err = dep.AddResponse(msg.Id, "response", false)
	if err != nil {
		t.Fatal(err)
	}
	responses, err := dep.GetResponses()
	if len(responses) == 0 {
		t.Fatal("Deployment has no responses")
	}
}
예제 #2
0
func TestDeploymentDetail(t *testing.T) {
	mb, err := mailbox.Create("deployment.detail")
	if err != nil {
		t.Fatal(err)
	}
	dep := mailbox.Deployment{MessageBody: "test message"}
	err = dep.Create()
	if err != nil {
		t.Fatal(err)
	}
	_, err = mb.DeployMessage(dep.Id)
	if err != nil {
		t.Fatal(err)
	}
	err = dep.AddResponse(mb.Id, "test repsonse", false)
	if err != nil {
		t.Fatal(err)
	}
	pmClient.Mailbox = mb.Id
	resp, err := pmClient.DeploymentDetail(dep.Id)
	if err != nil {
		t.Fatal(err)
	}
	if len(resp.Deployments) == 0 {
		t.Fatal("No deployments returned")
	}
	if len(resp.Deployments[0].Responses) == 0 {
		t.Fatal("No deployment responses returned")
	}
}