Use base test messenger suite
This commit is contained in:
parent
23ca4ba204
commit
7da855c0bf
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/services/browsers"
|
||||
"github.com/status-im/status-go/waku"
|
||||
|
@ -41,15 +40,6 @@ func (s *BrowserSuite) TearDownTest() {
|
|||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *BrowserSuite) newMessenger() *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerBackupSuite) TestBrowsersOrderedNewestFirst() {
|
||||
msngr := s.newMessenger()
|
||||
testBrowsers := []*browsers.Browser{
|
||||
|
|
|
@ -7,15 +7,12 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/multiaccounts/settings"
|
||||
"github.com/status-im/status-go/protocol/common"
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestMessengerContactRequestSuite(t *testing.T) {
|
||||
|
@ -26,34 +23,6 @@ type MessengerContactRequestSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerContactRequestSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerContactRequestSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerContactRequestSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerContactRequestSuite) findFirstByContentType(messages []*common.Message, contentType protobuf.ChatMessage_ContentType) *common.Message {
|
||||
return FindFirstByContentType(messages, contentType)
|
||||
}
|
||||
|
@ -380,7 +349,7 @@ func (s *MessengerContactRequestSuite) syncInstallationContactV2FromContact(cont
|
|||
func (s *MessengerContactRequestSuite) TestReceiveAndAcceptContactRequest() { //nolint: unused
|
||||
messageText := "hello!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -398,7 +367,7 @@ func (s *MessengerContactRequestSuite) TestReceiveAndAcceptContactRequest() { //
|
|||
func (s *MessengerContactRequestSuite) TestReceiveAndDismissContactRequest() {
|
||||
messageText := "hello!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -416,7 +385,7 @@ func (s *MessengerContactRequestSuite) TestReceiveAndDismissContactRequest() {
|
|||
func (s *MessengerContactRequestSuite) TestReceiveAcceptAndRetractContactRequest() { //nolint: unused
|
||||
messageText := "hello!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -437,7 +406,7 @@ func (s *MessengerContactRequestSuite) TestReceiveAcceptAndRetractContactRequest
|
|||
func (s *MessengerContactRequestSuite) TestReceiveAndAcceptContactRequestTwice() { //nolint: unused
|
||||
messageText := "hello!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -494,7 +463,7 @@ func (s *MessengerContactRequestSuite) TestReceiveAndAcceptContactRequestTwice()
|
|||
func (s *MessengerContactRequestSuite) TestAcceptLatestContactRequestForContact() {
|
||||
messageText := "hello!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -589,7 +558,7 @@ func (s *MessengerContactRequestSuite) TestAcceptLatestContactRequestForContact(
|
|||
func (s *MessengerContactRequestSuite) TestDismissLatestContactRequestForContact() {
|
||||
messageText := "hello!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -635,7 +604,7 @@ func (s *MessengerContactRequestSuite) TestPairedDevicesRemoveContact() {
|
|||
pairTwoDevices(&s.Suite, alice1, alice2)
|
||||
pairTwoDevices(&s.Suite, alice2, alice1)
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err = bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
@ -699,7 +668,7 @@ func (s *MessengerContactRequestSuite) TestAliceRecoverStateSendContactRequest()
|
|||
|
||||
alice1 := s.m
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err := bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
@ -771,7 +740,7 @@ func (s *MessengerContactRequestSuite) TestAliceRecoverStateReceiveContactReques
|
|||
|
||||
alice1 := s.m
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err := bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
@ -852,7 +821,7 @@ func (s *MessengerContactRequestSuite) TestAliceOfflineRetractsAndAddsCorrectOrd
|
|||
|
||||
alice1 := s.m
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err := bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
@ -902,7 +871,7 @@ func (s *MessengerContactRequestSuite) TestAliceOfflineRetractsAndAddsWrongOrder
|
|||
|
||||
alice1 := s.m
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err := bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
@ -954,7 +923,7 @@ func (s *MessengerContactRequestSuite) TestAliceOfflineRetractsAndAddsWrongOrder
|
|||
func (s *MessengerContactRequestSuite) TestAliceResendsContactRequestAfterRemovingBobFromContacts() {
|
||||
messageTextFirst := "hello 1!"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -1010,7 +979,7 @@ func (s *MessengerContactRequestSuite) TestBobSendsContactRequestAfterDecliningO
|
|||
|
||||
alice := s.m
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err := bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
@ -1193,7 +1162,7 @@ func (s *MessengerContactRequestSuite) TestBobRestoresIncomingContactRequestFrom
|
|||
|
||||
alice := s.m
|
||||
|
||||
bob1 := s.newMessenger(s.shh)
|
||||
bob1 := s.newMessenger()
|
||||
_, err := bob1.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob1.Shutdown() // nolint: errcheck
|
||||
|
@ -1273,7 +1242,7 @@ func (s *MessengerContactRequestSuite) TestAliceRestoresOutgoingContactRequestFr
|
|||
|
||||
alice1 := s.m
|
||||
|
||||
bob := s.newMessenger(s.shh)
|
||||
bob := s.newMessenger()
|
||||
_, err := bob.Start()
|
||||
s.Require().NoError(err)
|
||||
defer bob.Shutdown() // nolint: errcheck
|
||||
|
|
|
@ -32,31 +32,18 @@ func (s *MessengerContactUpdateSuite) SetupTest() {
|
|||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.m = s.newMessenger()
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerContactUpdateSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerContactUpdateSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerContactUpdateSuite) TestReceiveContactUpdate() {
|
||||
theirName := "ens-name.stateofus.eth"
|
||||
|
||||
contactID := types.EncodeHex(crypto.FromECDSAPub(&s.m.identity.PublicKey))
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -124,7 +111,7 @@ func (s *MessengerContactUpdateSuite) TestReceiveContactUpdate() {
|
|||
func (s *MessengerContactUpdateSuite) TestAddContact() {
|
||||
contactID := types.EncodeHex(crypto.FromECDSAPub(&s.m.identity.PublicKey))
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
@ -158,7 +145,7 @@ func (s *MessengerContactUpdateSuite) TestAddContactWithENS() {
|
|||
contactID := types.EncodeHex(crypto.FromECDSAPub(&s.m.identity.PublicKey))
|
||||
ensName := "blah.stateofus.eth"
|
||||
|
||||
theirMessenger := s.newMessenger(s.shh)
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
s.Require().NoError(err)
|
||||
defer theirMessenger.Shutdown() // nolint: errcheck
|
||||
|
|
|
@ -6,14 +6,11 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/protocol/common"
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestMessengerEditMessageSuite(t *testing.T) {
|
||||
|
@ -24,34 +21,6 @@ type MessengerEditMessageSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerEditMessageSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger()
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerEditMessageSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerEditMessageSuite) newMessenger() *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerEditMessageSuite) TestEditMessage() {
|
||||
theirMessenger := s.newMessenger()
|
||||
_, err := theirMessenger.Start()
|
||||
|
|
|
@ -8,14 +8,11 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/multiaccounts"
|
||||
"github.com/status-im/status-go/protocol/common"
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestMessengerEmojiSuite(t *testing.T) {
|
||||
|
@ -26,34 +23,6 @@ type MessengerEmojiSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerEmojiSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerEmojiSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerEmojiSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerEmojiSuite) TestSendEmoji() {
|
||||
alice := s.m
|
||||
alice.account = &multiaccounts.Account{KeyUID: "0xdeadbeef"}
|
||||
|
@ -140,7 +109,7 @@ func (s *MessengerEmojiSuite) TestSendEmoji() {
|
|||
|
||||
func (s *MessengerEmojiSuite) TestEmojiPrivateGroup() {
|
||||
bob := s.m
|
||||
alice := s.newMessenger(s.shh)
|
||||
alice := s.newMessenger()
|
||||
_, err := alice.Start()
|
||||
s.Require().NoError(err)
|
||||
defer alice.Shutdown() // nolint: errcheck
|
||||
|
|
|
@ -8,13 +8,9 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
userimage "github.com/status-im/status-go/images"
|
||||
"github.com/status-im/status-go/protocol/common"
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestGroupChatSuite(t *testing.T) {
|
||||
|
@ -25,16 +21,6 @@ type MessengerGroupChatSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerGroupChatSuite) newMessenger() *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, []Option{})
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerGroupChatSuite) startNewMessenger() *Messenger {
|
||||
messenger := s.newMessenger()
|
||||
|
||||
|
@ -44,19 +30,6 @@ func (s *MessengerGroupChatSuite) startNewMessenger() *Messenger {
|
|||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerGroupChatSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
}
|
||||
|
||||
func (s *MessengerGroupChatSuite) TearDownTest() {
|
||||
}
|
||||
|
||||
func (s *MessengerGroupChatSuite) createGroupChat(creator *Messenger, name string, members []string) *Chat {
|
||||
response, err := creator.CreateGroupChatWithMembers(context.Background(), name, members)
|
||||
s.Require().NoError(err)
|
||||
|
|
|
@ -5,16 +5,11 @@ import (
|
|||
"errors"
|
||||
"testing"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
)
|
||||
|
||||
const testDisplayName = "My New Display Name"
|
||||
|
@ -27,35 +22,6 @@ type MessengerProfileDisplayNameHandlerSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerProfileDisplayNameHandlerSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
// We start the messenger in order to receive installations
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerProfileDisplayNameHandlerSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerProfileDisplayNameHandlerSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
func (s *MessengerProfileDisplayNameHandlerSuite) TestDisplayNameChange() {
|
||||
// check display name for the created instance
|
||||
displayName, err := s.m.settings.DisplayName()
|
||||
|
|
|
@ -9,13 +9,11 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
const statusChatID = "status"
|
||||
|
@ -29,36 +27,6 @@ type MessengerInstallationSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerInstallationSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
// We start the messenger in order to receive installations
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerInstallationSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerInstallationSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerInstallationSuite) TestReceiveInstallation() {
|
||||
theirMessenger, err := newMessengerWithKey(s.shh, s.privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
@ -297,7 +265,7 @@ func (s *MessengerInstallationSuite) TestSyncInstallationNewMessages() {
|
|||
// pair
|
||||
bob2, err := newMessengerWithKey(s.shh, s.privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
alice := s.newMessenger(s.shh)
|
||||
alice := s.newMessenger()
|
||||
|
||||
err = bob2.SetInstallationMetadata(bob2.installationID, &multidevice.InstallationMetadata{
|
||||
Name: "their-name",
|
||||
|
|
|
@ -7,12 +7,8 @@ import (
|
|||
"github.com/stretchr/testify/suite"
|
||||
"go.uber.org/zap"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestMessengerMuteSuite(t *testing.T) {
|
||||
|
@ -23,34 +19,6 @@ type MessengerMuteSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerMuteSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerMuteSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerMuteSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerMuteSuite) TestSetMute() {
|
||||
key, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
|
|
@ -6,12 +6,8 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/multiaccounts"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestMessengerReplySuite(t *testing.T) {
|
||||
|
@ -22,34 +18,6 @@ type MessengerReplySuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerReplySuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerReplySuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerReplySuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerReplySuite) TestReceiveReply() {
|
||||
alice := s.m
|
||||
alice.account = &multiaccounts.Account{KeyUID: "0xdeadbeef"}
|
||||
|
|
|
@ -8,16 +8,13 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/protocol/common"
|
||||
"github.com/status-im/status-go/protocol/communities"
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/protocol/urls"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestMessengerShareUrlsSuite(t *testing.T) {
|
||||
|
@ -28,34 +25,6 @@ type MessengerShareUrlsSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerShareUrlsSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger()
|
||||
s.privateKey = s.m.identity
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerShareUrlsSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerShareUrlsSuite) newMessenger() *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerShareUrlsSuite) createCommunity() *communities.Community {
|
||||
description := &requests.CreateCommunity{
|
||||
Membership: protobuf.CommunityPermissions_NO_MEMBERSHIP,
|
||||
|
|
|
@ -8,15 +8,10 @@ import (
|
|||
"github.com/status-im/status-go/protocol/common"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
)
|
||||
|
||||
func TestMessengerSyncClearHistorySuite(t *testing.T) {
|
||||
|
@ -27,36 +22,6 @@ type MessengerSyncClearHistory struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerSyncClearHistory) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
// We start the messenger in order to receive installations
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerSyncClearHistory) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerSyncClearHistory) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerSyncClearHistory) pair() *Messenger {
|
||||
theirMessenger, err := newMessengerWithKey(s.shh, s.privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
|
|
@ -6,16 +6,11 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/images"
|
||||
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
)
|
||||
|
||||
func TestMessengerSyncProfilePictureSuite(t *testing.T) {
|
||||
|
@ -26,36 +21,6 @@ type MessengerSyncProfilePictureSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerSyncProfilePictureSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
// We start the messenger in order to receive installations
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerSyncProfilePictureSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerSyncProfilePictureSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *MessengerSyncProfilePictureSuite) TestSyncProfilePicture() {
|
||||
|
||||
// Add identity images
|
||||
|
|
|
@ -5,16 +5,11 @@ import (
|
|||
"errors"
|
||||
"testing"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
)
|
||||
|
||||
func TestMessengerSyncWalletSuite(t *testing.T) {
|
||||
|
@ -25,36 +20,6 @@ type MessengerSyncWalletSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *MessengerSyncWalletSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
// We start the messenger in order to receive installations
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerSyncWalletSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *MessengerSyncWalletSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
|
||||
// user should not be able to change a keypair name directly, it follows display name
|
||||
func (s *MessengerSyncWalletSuite) TestProfileKeypairNameChange() {
|
||||
profileKp := accounts.GetProfileKeypairForTest(true, false, false)
|
||||
|
|
|
@ -5,12 +5,7 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
"github.com/status-im/status-go/protocol/tt"
|
||||
"github.com/status-im/status-go/waku"
|
||||
)
|
||||
|
||||
func TestWalletConnectSessionsSuite(t *testing.T) {
|
||||
|
@ -21,36 +16,6 @@ type WalletConnectSessionsSuite struct {
|
|||
MessengerBaseTestSuite
|
||||
}
|
||||
|
||||
func (s *WalletConnectSessionsSuite) SetupTest() {
|
||||
s.logger = tt.MustCreateTestLogger()
|
||||
|
||||
config := waku.DefaultConfig
|
||||
config.MinimumAcceptedPoW = 0
|
||||
shh := waku.New(&config, s.logger)
|
||||
s.shh = gethbridge.NewGethWakuWrapper(shh)
|
||||
s.Require().NoError(shh.Start())
|
||||
|
||||
s.m = s.newMessenger(s.shh)
|
||||
s.privateKey = s.m.identity
|
||||
// We start the messenger in order to receive installations
|
||||
_, err := s.m.Start()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *WalletConnectSessionsSuite) TearDownTest() {
|
||||
s.Require().NoError(s.m.Shutdown())
|
||||
}
|
||||
|
||||
func (s *WalletConnectSessionsSuite) newMessenger(shh types.Waku) *Messenger {
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
|
||||
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return messenger
|
||||
}
|
||||
|
||||
func (s *WalletConnectSessionsSuite) TestCreateReadAndDeleteSessions() {
|
||||
peerID1 := "0643983b-0000-2222-1111-b05fdac338zd1"
|
||||
peerID2 := "0643983b-0000-2222-1111-b05fdac338zd2"
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"go.uber.org/zap"
|
||||
|
||||
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
|
||||
"github.com/status-im/status-go/eth-node/crypto"
|
||||
|
@ -33,7 +34,13 @@ func TestMessengerPushNotificationSuite(t *testing.T) {
|
|||
}
|
||||
|
||||
type MessengerPushNotificationSuite struct {
|
||||
MessengerBaseTestSuite
|
||||
suite.Suite
|
||||
m *Messenger // main instance of Messenger
|
||||
privateKey *ecdsa.PrivateKey // private key for the main instance of Messenger
|
||||
// If one wants to send messages between different instances of Messenger,
|
||||
// a single Waku service should be shared.
|
||||
shh types.Waku
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func (s *MessengerPushNotificationSuite) SetupTest() {
|
||||
|
|
Loading…
Reference in New Issue