mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 14:11:23 -04:00
create and removing from webrtcRemotes test
This commit is contained in:
parent
b2d7586cb4
commit
f024f6b832
1 changed files with 14 additions and 0 deletions
|
@ -49,6 +49,7 @@ func (m *MockTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
|
||||||
func TestConnect(t *testing.T) {
|
func TestConnect(t *testing.T) {
|
||||||
Convey("Snowflake", t, func() {
|
Convey("Snowflake", t, func() {
|
||||||
|
webrtcRemotes = make(map[int]*webRTCConn)
|
||||||
|
|
||||||
Convey("WebRTC Connection", func() {
|
Convey("WebRTC Connection", func() {
|
||||||
c := new(webRTCConn)
|
c := new(webRTCConn)
|
||||||
|
@ -58,6 +59,19 @@ func TestConnect(t *testing.T) {
|
||||||
}
|
}
|
||||||
So(c.buffer.Bytes(), ShouldEqual, nil)
|
So(c.buffer.Bytes(), ShouldEqual, nil)
|
||||||
|
|
||||||
|
Convey("Create and remove from WebRTCConn set", func() {
|
||||||
|
So(len(webrtcRemotes), ShouldEqual, 0)
|
||||||
|
So(remoteIndex, ShouldEqual, 0)
|
||||||
|
s := NewWebRTCConnection(nil, nil)
|
||||||
|
So(s, ShouldNotBeNil)
|
||||||
|
So(s.index, ShouldEqual, 0)
|
||||||
|
So(len(webrtcRemotes), ShouldEqual, 1)
|
||||||
|
So(remoteIndex, ShouldEqual, 1)
|
||||||
|
s.Close()
|
||||||
|
So(len(webrtcRemotes), ShouldEqual, 0)
|
||||||
|
So(remoteIndex, ShouldEqual, 1)
|
||||||
|
})
|
||||||
|
|
||||||
Convey("Write buffers when datachannel is nil", func() {
|
Convey("Write buffers when datachannel is nil", func() {
|
||||||
c.Write([]byte("test"))
|
c.Write([]byte("test"))
|
||||||
c.snowflake = nil
|
c.snowflake = nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue