Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

events_test.go 766B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package mtglib_test
  2. import (
  3. "net"
  4. "testing"
  5. "time"
  6. "github.com/9seconds/mtg/v2/mtglib"
  7. "github.com/stretchr/testify/suite"
  8. )
  9. type EventsTestSuite struct {
  10. suite.Suite
  11. }
  12. func (suite *EventsTestSuite) TestEventStart() {
  13. evt := mtglib.EventStart{
  14. CreatedAt: time.Now(),
  15. ConnID: "CONNID",
  16. RemoteIP: net.ParseIP("10.0.0.10"),
  17. }
  18. suite.Equal("CONNID", evt.StreamID())
  19. }
  20. func (suite *EventsTestSuite) TestEventFinish() {
  21. evt := mtglib.EventFinish{
  22. CreatedAt: time.Now(),
  23. ConnID: "CONNID",
  24. }
  25. suite.Equal("CONNID", evt.StreamID())
  26. }
  27. func (suite *EventsTestSuite) TestEventConcurrencyLimited() {
  28. suite.Empty(mtglib.EventConcurrencyLimited{}.StreamID())
  29. }
  30. func TestEvents(t *testing.T) {
  31. t.Parallel()
  32. suite.Run(t, &EventsTestSuite{})
  33. }