Use base test messenger suite

This commit is contained in:
Andrea Maria Piana 2023-07-13 11:28:34 +01:00
parent 8bfcb80ed6
commit 23ca4ba204
17 changed files with 17 additions and 178 deletions

View File

@ -2,7 +2,6 @@ package protocol
import (
"context"
"crypto/ecdsa"
"encoding/json"
"fmt"
"testing"
@ -10,7 +9,6 @@ import (
"github.com/status-im/status-go/protocol/identity"
"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"
@ -29,13 +27,7 @@ func TestMessengerBackupSuite(t *testing.T) {
}
type MessengerBackupSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerBackupSuite) SetupTest() {
@ -57,15 +49,6 @@ func (s *MessengerBackupSuite) TearDownTest() {
s.Require().NoError(s.m.Shutdown())
}
func (s *MessengerBackupSuite) 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) TestBackupContacts() {
bob1 := s.m
// Create bob2

View File

@ -2,16 +2,13 @@ package protocol
import (
"context"
"crypto/ecdsa"
"sort"
"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"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/browsers"
"github.com/status-im/status-go/waku"
@ -22,13 +19,7 @@ func TestBrowserSuite(t *testing.T) {
}
type BrowserSuite struct {
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
MessengerBaseTestSuite
}
func (s *BrowserSuite) SetupTest() {

View File

@ -2,12 +2,10 @@ package protocol
import (
"context"
"crypto/ecdsa"
"fmt"
"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"
@ -25,13 +23,7 @@ func TestMessengerContactRequestSuite(t *testing.T) {
}
type MessengerContactRequestSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerContactRequestSuite) SetupTest() {

View File

@ -2,11 +2,9 @@ package protocol
import (
"context"
"crypto/ecdsa"
"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"
@ -22,13 +20,7 @@ func TestMessengerContactUpdateSuite(t *testing.T) {
}
type MessengerContactUpdateSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerContactUpdateSuite) SetupTest() {

View File

@ -2,11 +2,9 @@ package protocol
import (
"context"
"crypto/ecdsa"
"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"
@ -23,13 +21,7 @@ func TestMessengerEditMessageSuite(t *testing.T) {
}
type MessengerEditMessageSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerEditMessageSuite) SetupTest() {

View File

@ -2,13 +2,11 @@ package protocol
import (
"context"
"crypto/ecdsa"
"encoding/json"
"strings"
"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"
@ -25,15 +23,7 @@ func TestMessengerEmojiSuite(t *testing.T) {
}
type MessengerEmojiSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerEmojiSuite) SetupTest() {

View File

@ -7,11 +7,9 @@ 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"
"github.com/status-im/status-go/eth-node/types"
userimage "github.com/status-im/status-go/images"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/protobuf"
@ -24,12 +22,7 @@ func TestGroupChatSuite(t *testing.T) {
}
type MessengerGroupChatSuite struct {
suite.Suite
// If one wants to send messages between different instances of Messenger,
// a single Waku service should be shared.
shh types.Waku
logger *zap.Logger
MessengerBaseTestSuite
}
func (s *MessengerGroupChatSuite) newMessenger() *Messenger {

View File

@ -2,7 +2,6 @@ package protocol
import (
"context"
"crypto/ecdsa"
"errors"
"testing"
@ -14,7 +13,6 @@ import (
"github.com/status-im/status-go/waku"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
"github.com/status-im/status-go/eth-node/types"
)
@ -26,15 +24,7 @@ func TestMessengerProfileDisplayNameHandlerSuite(t *testing.T) {
}
type MessengerProfileDisplayNameHandlerSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerProfileDisplayNameHandlerSuite) SetupTest() {

View File

@ -2,14 +2,12 @@ package protocol
import (
"context"
"crypto/ecdsa"
"errors"
"testing"
"github.com/status-im/status-go/services/browsers"
"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"
@ -28,15 +26,7 @@ func TestMessengerInstallationSuite(t *testing.T) {
}
type MessengerInstallationSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerInstallationSuite) SetupTest() {

View File

@ -1,7 +1,6 @@
package protocol
import (
"crypto/ecdsa"
"testing"
"time"
@ -21,15 +20,7 @@ func TestMessengerMuteSuite(t *testing.T) {
}
type MessengerMuteSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerMuteSuite) SetupTest() {

View File

@ -2,11 +2,9 @@ package protocol
import (
"context"
"crypto/ecdsa"
"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"
@ -21,15 +19,7 @@ func TestMessengerReplySuite(t *testing.T) {
}
type MessengerReplySuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerReplySuite) SetupTest() {

View File

@ -2,13 +2,11 @@ package protocol
import (
"context"
"crypto/ecdsa"
"fmt"
"strings"
"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"
@ -27,13 +25,7 @@ func TestMessengerShareUrlsSuite(t *testing.T) {
}
type MessengerShareUrlsSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerShareUrlsSuite) SetupTest() {

View File

@ -2,7 +2,6 @@ package protocol
import (
"context"
"crypto/ecdsa"
"errors"
"testing"
@ -16,7 +15,6 @@ import (
"github.com/status-im/status-go/waku"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
"github.com/status-im/status-go/eth-node/types"
)
@ -26,15 +24,7 @@ func TestMessengerSyncClearHistorySuite(t *testing.T) {
}
type MessengerSyncClearHistory struct {
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
MessengerBaseTestSuite
}
func (s *MessengerSyncClearHistory) SetupTest() {

View File

@ -2,7 +2,6 @@ package protocol
import (
"context"
"crypto/ecdsa"
"errors"
"fmt"
"testing"
@ -15,7 +14,6 @@ import (
"github.com/status-im/status-go/waku"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
"github.com/status-im/status-go/eth-node/types"
)
@ -25,15 +23,7 @@ func TestMessengerSyncProfilePictureSuite(t *testing.T) {
}
type MessengerSyncProfilePictureSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerSyncProfilePictureSuite) SetupTest() {

View File

@ -2,7 +2,6 @@ package protocol
import (
"context"
"crypto/ecdsa"
"errors"
"testing"
@ -14,7 +13,6 @@ import (
"github.com/status-im/status-go/waku"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
"github.com/status-im/status-go/eth-node/types"
)
@ -24,15 +22,7 @@ func TestMessengerSyncWalletSuite(t *testing.T) {
}
type MessengerSyncWalletSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerSyncWalletSuite) SetupTest() {

View File

@ -1,11 +1,9 @@
package protocol
import (
"crypto/ecdsa"
"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"
@ -20,15 +18,7 @@ func TestWalletConnectSessionsSuite(t *testing.T) {
}
type WalletConnectSessionsSuite struct {
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
MessengerBaseTestSuite
}
func (s *WalletConnectSessionsSuite) SetupTest() {

View File

@ -8,7 +8,6 @@ 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"
@ -34,13 +33,7 @@ func TestMessengerPushNotificationSuite(t *testing.T) {
}
type MessengerPushNotificationSuite struct {
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
MessengerBaseTestSuite
}
func (s *MessengerPushNotificationSuite) SetupTest() {