Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
osmaczko committed Feb 4, 2025
1 parent 0e5ef91 commit f41c7a9
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 64 deletions.
18 changes: 13 additions & 5 deletions protocol/messenger_delete_message_for_me_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand Down Expand Up @@ -59,11 +59,19 @@ func (s *MessengerDeleteMessageForMeSuite) otherNewMessenger() *Messenger {
func (s *MessengerDeleteMessageForMeSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.alice1 = s.newMessenger()
s.alice2 = s.newMessenger()
Expand Down
20 changes: 13 additions & 7 deletions protocol/messenger_identity_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"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/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand All @@ -44,13 +44,19 @@ type MessengerProfilePictureHandlerSuite struct {
func (s *MessengerProfilePictureHandlerSuite) SetupSuite() {
s.logger = tt.MustCreateTestLogger()

// Setup Waku things
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
wakuLogger := s.logger.Named("Waku")
shh := wakuv1.New(&config, wakuLogger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger.Named("Waku"),
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh
}

func (s *MessengerProfilePictureHandlerSuite) TearDownSuite() {
Expand Down
20 changes: 14 additions & 6 deletions protocol/messenger_peersyncing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/status-im/status-go/protocol/peersyncing"
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand All @@ -42,11 +42,19 @@ func (s *MessengerPeersyncingSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()
peerSyncingLoopInterval = 500 * time.Millisecond

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.owner = s.newMessenger()
s.bob = s.newMessenger()
Expand All @@ -66,7 +74,7 @@ func (s *MessengerPeersyncingSuite) SetupTest() {
s.accountsPasswords[common.PubkeyToHex(&s.bob.identity.PublicKey)] = bobPassword
s.accountsPasswords[common.PubkeyToHex(&s.alice.identity.PublicKey)] = aliceAddress1

_, err := s.owner.Start()
_, err = s.owner.Start()
s.Require().NoError(err)
_, err = s.bob.Start()
s.Require().NoError(err)
Expand Down
18 changes: 13 additions & 5 deletions protocol/messenger_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/multiaccounts/common"
Expand All @@ -27,11 +27,19 @@ type MessengerSettingsSuite struct {
func (s *MessengerSettingsSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

pk, err := crypto.GenerateKey()
s.Require().NoError(err)
Expand Down
18 changes: 13 additions & 5 deletions protocol/messenger_sync_chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand Down Expand Up @@ -60,11 +60,19 @@ func (s *MessengerSyncChatSuite) otherNewMessenger() *Messenger {
func (s *MessengerSyncChatSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.alice1 = s.newMessenger()
s.alice2 = s.newMessenger()
Expand Down
18 changes: 13 additions & 5 deletions protocol/messenger_sync_customization_color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"go.uber.org/zap"

"github.com/status-im/status-go/multiaccounts/common"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/protocol/encryption/multidevice"
Expand All @@ -34,11 +34,19 @@ type MessengerSyncAccountCustomizationColorSuite struct {
func (s *MessengerSyncAccountCustomizationColorSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

pk, err := crypto.GenerateKey()
s.Require().NoError(err)
Expand Down
19 changes: 13 additions & 6 deletions protocol/messenger_sync_keycard_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"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/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand All @@ -37,16 +37,23 @@ type MessengerSyncKeycardChangeSuite struct {
func (s *MessengerSyncKeycardChangeSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.main = s.newMessenger(s.shh)
s.privateKey = s.main.identity

var err error
// Create new device and add main account to
s.other, err = newMessengerWithKey(s.shh, s.main.identity, s.logger, nil)
s.Require().NoError(err)
Expand Down
19 changes: 13 additions & 6 deletions protocol/messenger_sync_keycards_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"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/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand All @@ -37,16 +37,23 @@ type MessengerSyncKeycardsStateSuite struct {
func (s *MessengerSyncKeycardsStateSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.main = s.newMessenger(s.shh)
s.privateKey = s.main.identity

var err error
// Create new device and add main account to
s.other, err = newMessengerWithKey(s.shh, s.main.identity, s.logger, nil)
s.Require().NoError(err)
Expand Down
19 changes: 13 additions & 6 deletions protocol/messenger_sync_saved_addresses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/wallet"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand All @@ -41,16 +41,23 @@ type MessengerSyncSavedAddressesSuite struct {
func (s *MessengerSyncSavedAddressesSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.main = s.newMessenger(s.logger.Named("main"))
s.privateKey = s.main.identity

var err error
// Create new device and add main account to
s.other, err = newMessengerWithKey(s.shh, s.main.identity, s.logger.Named("other"), nil)
s.Require().NoError(err)
Expand Down
20 changes: 14 additions & 6 deletions protocol/messenger_sync_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/stickers"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand Down Expand Up @@ -80,14 +80,22 @@ func (s *MessengerSyncSettingsSuite) SetupSuite() {
func (s *MessengerSyncSettingsSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.alice = s.newMessenger()
_, err := s.alice.Start()
_, err = s.alice.Start()
s.Require().NoError(err)

s.alice2, err = newMessengerWithKey(s.shh, s.alice.identity, s.logger, nil)
Expand Down
18 changes: 13 additions & 5 deletions protocol/push_notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/status-im/status-go/protocol/pushnotificationserver"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2"

wakutypes "github.com/status-im/status-go/waku/types"
)
Expand Down Expand Up @@ -47,11 +47,19 @@ type MessengerPushNotificationSuite struct {
func (s *MessengerPushNotificationSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()

config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = shh
shh, err := wakuv2.New(
nil,
"",
&wakuv2.DefaultConfig,
s.logger,
nil,
nil,
nil,
nil,
)
s.Require().NoError(err)
s.Require().NoError(shh.Start())
s.shh = shh

s.m = s.newMessenger(s.shh)
s.privateKey = s.m.identity
Expand Down
Loading

0 comments on commit f41c7a9

Please sign in to comment.