mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Refactor (De)SerializeSessionDescription as common utils
This commit is contained in:
parent
c11461d339
commit
d10af300c1
6 changed files with 72 additions and 109 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/common/messages"
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/common/util"
|
||||
"github.com/pion/webrtc/v2"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
@ -197,7 +198,7 @@ func TestSessionDescriptions(t *testing.T) {
|
|||
},
|
||||
},
|
||||
} {
|
||||
desc := deserializeSessionDescription(test.msg)
|
||||
desc := util.DeserializeSessionDescription(test.msg)
|
||||
So(desc, ShouldResemble, test.ret)
|
||||
}
|
||||
})
|
||||
|
@ -214,7 +215,7 @@ func TestSessionDescriptions(t *testing.T) {
|
|||
`{"type":"offer","sdp":"test"}`,
|
||||
},
|
||||
} {
|
||||
msg := serializeSessionDescription(test.desc)
|
||||
msg := util.SerializeSessionDescription(test.desc)
|
||||
So(msg, ShouldResemble, test.ret)
|
||||
}
|
||||
})
|
||||
|
@ -239,7 +240,7 @@ func TestBrokerInteractions(t *testing.T) {
|
|||
},
|
||||
}
|
||||
pc, _ := webrtc.NewPeerConnection(config)
|
||||
offer := deserializeSessionDescription(sampleOffer)
|
||||
offer := util.DeserializeSessionDescription(sampleOffer)
|
||||
pc.SetRemoteDescription(*offer)
|
||||
answer, _ := pc.CreateAnswer(nil)
|
||||
pc.SetLocalDescription(answer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue