28 lines
850 B
Go
28 lines
850 B
Go
package sipcall
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
type incompleteCapture struct{ fakeCapture }
|
|
|
|
func (c *incompleteCapture) Stop(ctx context.Context, id string) (Evidence, error) {
|
|
e, err := c.fakeCapture.Stop(ctx, id)
|
|
e.FinalINVITECode = 0
|
|
return e, err
|
|
}
|
|
|
|
func TestDebugCannotReportSuccessWithMissingINVITEFinalResponse(t *testing.T) {
|
|
c := fixtureConfig(t)
|
|
h := &fakeHost{}
|
|
r, err := run(context.Background(), c, "18601010101", true, h, func(context.Context, Config, string) (captureSession, error) { return &incompleteCapture{}, nil })
|
|
if err == nil || !strings.Contains(err.Error(), "2xx") || r.Status == "connected" {
|
|
t.Fatalf("missing final wire evidence disguised as success: %+v %v", r, err)
|
|
}
|
|
if r.AnsweredAt == nil || !r.EndConfirmed {
|
|
t.Fatal("evidence failure must not erase the genuine native call facts")
|
|
}
|
|
}
|