mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add test for proxy poll with Relay URL
This commit is contained in:
parent
6e8fbe54ee
commit
1b48ee14f4
1 changed files with 28 additions and 0 deletions
|
@ -194,6 +194,34 @@ func TestEncodeProxyPollResponse(t *testing.T) {
|
||||||
So(err, ShouldEqual, nil)
|
So(err, ShouldEqual, nil)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEncodeProxyPollResponseWithProxyURL(t *testing.T) {
|
||||||
|
Convey("Context", t, func() {
|
||||||
|
b, err := EncodePollResponseWithRelayURL("fake offer", true, "restricted", "wss://test/", "")
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
offer, natType, err := DecodePollResponse(b)
|
||||||
|
So(err, ShouldNotBeNil)
|
||||||
|
|
||||||
|
offer, natType, relay, err := DecodePollResponseWithRelayURL(b)
|
||||||
|
So(offer, ShouldEqual, "fake offer")
|
||||||
|
So(natType, ShouldEqual, "restricted")
|
||||||
|
So(relay, ShouldEqual, "wss://test/")
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
|
||||||
|
b, err = EncodePollResponse("", false, "unknown")
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
offer, natType, relay, err = DecodePollResponseWithRelayURL(b)
|
||||||
|
So(offer, ShouldEqual, "")
|
||||||
|
So(natType, ShouldEqual, "unknown")
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
|
||||||
|
b, err = EncodePollResponseWithRelayURL("fake offer", false, "restricted", "wss://test/", "test error reason")
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
offer, natType, relay, err = DecodePollResponseWithRelayURL(b)
|
||||||
|
So(err, ShouldNotBeNil)
|
||||||
|
So(err.Error(), ShouldContainSubstring, "test error reason")
|
||||||
|
})
|
||||||
|
}
|
||||||
func TestDecodeProxyAnswerRequest(t *testing.T) {
|
func TestDecodeProxyAnswerRequest(t *testing.T) {
|
||||||
Convey("Context", t, func() {
|
Convey("Context", t, func() {
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue