-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathremotepartyid_test.go
29 lines (26 loc) · 1.17 KB
/
remotepartyid_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2011, Shelby Ramsey. All rights reserved.
// Copyright 2018, Eugen Biegler. All rights reserved.
// Use of this code is governed by a BSD license that can be
// found in the LICENSE.txt file.
package sipparser
// Imports from the go standard library
import (
"testing"
)
func TestRpid(t *testing.T) {
sm := &SipMsg{}
s := "\"Unknown\" <sip:[email protected]>;party=calling;screen=yes;privacy=off"
sm.parseRemotePartyId(s)
if sm.Error != nil {
t.Errorf("[TestRpid] Error parsing rpid hdr: \"Unknown\" <sip:[email protected]>;party=calling;screen=yes;privacy=off. Received err: %v", sm.Error)
}
if sm.RemotePartyId.Name != "Unknown" {
t.Error("[TestRpid] Error parsing rpid hdr: \"Unknown\" <sip:[email protected]>;party=calling;screen=yes;privacy=off. Name should be \"Unknown\".")
}
if sm.RemotePartyId.URI == nil {
t.Error("[TestRpid] Error parsing rpid hdr: \"Unknown\" <sip:[email protected]>;party=calling;screen=yes;privacy=off. sm.RemotePartyId.URI is nil.")
}
if sm.RemotePartyId.Privacy != "off" {
t.Error("[TestRpid] Error parsing rpid hdr: \"Unknown\" <sip:[email protected]>;party=calling;screen=yes;privacy=off. Privacy should be \"off\".")
}
}