mirror of
https://github.com/status-im/status-go.git
synced 2025-02-20 10:48:36 +00:00
chore(communities)_: cover ERC721 based permissions reevaluation with tests
This commit is contained in:
parent
ec9e29ef92
commit
2d4ef8b2e0
@ -27,6 +27,8 @@ func (s *CommunityEventsEventualConsistencySuite) SetupTest() {
|
|||||||
s.logger = tt.MustCreateTestLogger()
|
s.logger = tt.MustCreateTestLogger()
|
||||||
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
||||||
|
|
||||||
|
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
||||||
|
|
||||||
config := waku.DefaultConfig
|
config := waku.DefaultConfig
|
||||||
config.MinimumAcceptedPoW = 0
|
config.MinimumAcceptedPoW = 0
|
||||||
shh := waku.New(&config, s.logger)
|
shh := waku.New(&config, s.logger)
|
||||||
@ -48,7 +50,6 @@ func (s *CommunityEventsEventualConsistencySuite) SetupTest() {
|
|||||||
_, err = s.alice.Start()
|
_, err = s.alice.Start()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommunityEventsEventualConsistencySuite) TearDownTest() {
|
func (s *CommunityEventsEventualConsistencySuite) TearDownTest() {
|
||||||
|
@ -61,6 +61,8 @@ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) SetupTest() {
|
|||||||
s.logger = tt.MustCreateTestLogger()
|
s.logger = tt.MustCreateTestLogger()
|
||||||
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
||||||
|
|
||||||
|
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
||||||
|
|
||||||
config := waku.DefaultConfig
|
config := waku.DefaultConfig
|
||||||
config.MinimumAcceptedPoW = 0
|
config.MinimumAcceptedPoW = 0
|
||||||
shh := waku.New(&config, s.logger)
|
shh := waku.New(&config, s.logger)
|
||||||
@ -76,8 +78,6 @@ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) SetupTest() {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
_, err = s.alice.Start()
|
_, err = s.alice.Start()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TearDownTest() {
|
func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TearDownTest() {
|
||||||
|
@ -61,6 +61,8 @@ func (s *TokenMasterCommunityEventsSuite) SetupTest() {
|
|||||||
s.logger = tt.MustCreateTestLogger()
|
s.logger = tt.MustCreateTestLogger()
|
||||||
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
||||||
|
|
||||||
|
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
||||||
|
|
||||||
config := waku.DefaultConfig
|
config := waku.DefaultConfig
|
||||||
config.MinimumAcceptedPoW = 0
|
config.MinimumAcceptedPoW = 0
|
||||||
shh := waku.New(&config, s.logger)
|
shh := waku.New(&config, s.logger)
|
||||||
@ -77,7 +79,6 @@ func (s *TokenMasterCommunityEventsSuite) SetupTest() {
|
|||||||
_, err = s.alice.Start()
|
_, err = s.alice.Start()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TokenMasterCommunityEventsSuite) TearDownTest() {
|
func (s *TokenMasterCommunityEventsSuite) TearDownTest() {
|
||||||
|
@ -67,6 +67,8 @@ func (s *AdminCommunityEventsSuiteBase) SetupTest() {
|
|||||||
s.logger = tt.MustCreateTestLogger()
|
s.logger = tt.MustCreateTestLogger()
|
||||||
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
s.collectiblesServiceMock = &CollectiblesServiceMock{}
|
||||||
|
|
||||||
|
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
||||||
|
|
||||||
config := waku.DefaultConfig
|
config := waku.DefaultConfig
|
||||||
config.MinimumAcceptedPoW = 0
|
config.MinimumAcceptedPoW = 0
|
||||||
shh := waku.New(&config, s.logger)
|
shh := waku.New(&config, s.logger)
|
||||||
@ -82,8 +84,6 @@ func (s *AdminCommunityEventsSuiteBase) SetupTest() {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
_, err = s.alice.Start()
|
_, err = s.alice.Start()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.mockedBalances = createMockedWalletBalance(&s.Suite)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AdminCommunityEventsSuiteBase) TearDownTest() {
|
func (s *AdminCommunityEventsSuiteBase) TearDownTest() {
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ import (
|
|||||||
"github.com/status-im/status-go/protocol/communities/token"
|
"github.com/status-im/status-go/protocol/communities/token"
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
"github.com/status-im/status-go/protocol/requests"
|
"github.com/status-im/status-go/protocol/requests"
|
||||||
|
"github.com/status-im/status-go/services/wallet/bigint"
|
||||||
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||||
walletToken "github.com/status-im/status-go/services/wallet/token"
|
walletToken "github.com/status-im/status-go/services/wallet/token"
|
||||||
@ -75,34 +77,84 @@ func (m *TokenManagerMock) FindOrCreateTokenByAddress(ctx context.Context, chain
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CollectiblesManagerMock struct {
|
type CollectiblesManagerMock struct {
|
||||||
response map[thirdparty.CollectibleUniqueID][]thirdparty.AccountBalance
|
Balances *map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big
|
||||||
|
collectibleOwnershipResponse map[string][]thirdparty.AccountBalance
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CollectiblesManagerMock) FetchBalancesByOwnerAndContractAddress(ctx context.Context, chainID walletCommon.ChainID,
|
func (m *CollectiblesManagerMock) FetchBalancesByOwnerAndContractAddress(ctx context.Context, chainID walletCommon.ChainID,
|
||||||
ownerAddress gethcommon.Address, contractAddresses []gethcommon.Address) (thirdparty.TokenBalancesPerContractAddress, error) {
|
ownerAddress gethcommon.Address, contractAddresses []gethcommon.Address) (thirdparty.TokenBalancesPerContractAddress, error) {
|
||||||
return nil, errors.New("FetchBalancesByOwnerAndContractAddress is not implemented for testCollectiblesManager")
|
ret := make(thirdparty.TokenBalancesPerContractAddress)
|
||||||
|
accountsBalances, ok := (*m.Balances)[uint64(chainID)]
|
||||||
|
if !ok {
|
||||||
|
return ret, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
balances, ok := accountsBalances[ownerAddress]
|
||||||
|
if !ok {
|
||||||
|
return ret, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, contractAddress := range contractAddresses {
|
||||||
|
balance, ok := balances[contractAddress]
|
||||||
|
if ok {
|
||||||
|
ret[contractAddress] = []thirdparty.TokenBalance{
|
||||||
|
{
|
||||||
|
TokenID: &bigint.BigInt{},
|
||||||
|
Balance: &bigint.BigInt{
|
||||||
|
Int: (*big.Int)(balance),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CollectiblesManagerMock) GetCollectibleOwnership(requestedID thirdparty.CollectibleUniqueID) ([]thirdparty.AccountBalance, error) {
|
func (m *CollectiblesManagerMock) GetCollectibleOwnership(requestedID thirdparty.CollectibleUniqueID) ([]thirdparty.AccountBalance, error) {
|
||||||
// NOTE: TokenID inside of thirdparty.CollectibleUniqueID is a pointer so m.response[id] is now working
|
for id, balances := range m.collectibleOwnershipResponse {
|
||||||
for id, balances := range m.response {
|
if id == requestedID.HashKey() {
|
||||||
if id.ContractID.Address == requestedID.ContractID.Address &&
|
|
||||||
id.ContractID.ChainID == requestedID.ContractID.ChainID {
|
|
||||||
return balances, nil
|
return balances, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return []thirdparty.AccountBalance{}, nil
|
return []thirdparty.AccountBalance{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CollectiblesManagerMock) SetResponse(id thirdparty.CollectibleUniqueID, balances []thirdparty.AccountBalance) {
|
func (m *CollectiblesManagerMock) FetchCollectibleOwnersByContractAddress(ctx context.Context, chainID walletCommon.ChainID, contractAddress gethcommon.Address) (*thirdparty.CollectibleContractOwnership, error) {
|
||||||
if m.response == nil {
|
ret := &thirdparty.CollectibleContractOwnership{
|
||||||
m.response = map[thirdparty.CollectibleUniqueID][]thirdparty.AccountBalance{}
|
ContractAddress: contractAddress,
|
||||||
|
Owners: []thirdparty.CollectibleOwner{},
|
||||||
}
|
}
|
||||||
m.response[id] = balances
|
accountsBalances, ok := (*m.Balances)[uint64(chainID)]
|
||||||
|
if !ok {
|
||||||
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CollectiblesManagerMock) FetchCollectibleOwnersByContractAddress(ctx context.Context, chainID walletCommon.ChainID, contractAddress gethcommon.Address) (*thirdparty.CollectibleContractOwnership, error) {
|
for wallet, collectiblesBalance := range accountsBalances {
|
||||||
return nil, errors.New("FetchCollectibleOwnersByContractAddress is not implemented for CollectiblesManagerMock")
|
balance, ok := collectiblesBalance[contractAddress]
|
||||||
|
if ok {
|
||||||
|
ret.Owners = append(ret.Owners, thirdparty.CollectibleOwner{
|
||||||
|
OwnerAddress: wallet,
|
||||||
|
TokenBalances: []thirdparty.TokenBalance{
|
||||||
|
{
|
||||||
|
TokenID: &bigint.BigInt{},
|
||||||
|
Balance: &bigint.BigInt{
|
||||||
|
Int: (*big.Int)(balance),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CollectiblesManagerMock) SetCollectibleOwnershipResponse(id thirdparty.CollectibleUniqueID, balances []thirdparty.AccountBalance) {
|
||||||
|
if m.collectibleOwnershipResponse == nil {
|
||||||
|
m.collectibleOwnershipResponse = map[string][]thirdparty.AccountBalance{}
|
||||||
|
}
|
||||||
|
m.collectibleOwnershipResponse[id.HashKey()] = balances
|
||||||
}
|
}
|
||||||
|
|
||||||
type CollectiblesServiceMock struct {
|
type CollectiblesServiceMock struct {
|
||||||
@ -260,7 +312,9 @@ func newTestCommunitiesMessenger(s *suite.Suite, waku types.Waku, config testCom
|
|||||||
Balances: config.mockedBalances,
|
Balances: config.mockedBalances,
|
||||||
}
|
}
|
||||||
|
|
||||||
collectiblesManagerMock := &CollectiblesManagerMock{}
|
collectiblesManagerMock := &CollectiblesManagerMock{
|
||||||
|
Balances: config.mockedBalances,
|
||||||
|
}
|
||||||
|
|
||||||
options := []Option{
|
options := []Option{
|
||||||
WithAccountManager(accountsManagerMock),
|
WithAccountManager(accountsManagerMock),
|
||||||
|
@ -158,6 +158,8 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) SetupTest() {
|
|||||||
s.bobWaku = nil
|
s.bobWaku = nil
|
||||||
s.aliceWaku = nil
|
s.aliceWaku = nil
|
||||||
|
|
||||||
|
s.resetMockedBalances()
|
||||||
|
|
||||||
s.logger = tt.MustCreateTestLogger()
|
s.logger = tt.MustCreateTestLogger()
|
||||||
|
|
||||||
wakuNodes := CreateWakuV2Network(&s.Suite, s.logger, false, []string{"owner", "bob", "alice"})
|
wakuNodes := CreateWakuV2Network(&s.Suite, s.logger, false, []string{"owner", "bob", "alice"})
|
||||||
@ -178,9 +180,6 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) SetupTest() {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
_, err = s.alice.Start()
|
_, err = s.alice.Start()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.resetMockedBalances()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) TearDownTest() {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TearDownTest() {
|
||||||
@ -1602,15 +1601,15 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestMemberRoleGetUpdatedWhen
|
|||||||
s.Require().Equal(msg.Text, response.Messages()[0].Text)
|
s.Require().Equal(msg.Text, response.Messages()[0].Text)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivilegedRoleInOpenCommunity(permissionType protobuf.CommunityTokenPermission_Type) {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivilegedRoleInOpenCommunity(permissionType protobuf.CommunityTokenPermission_Type, tokenType protobuf.CommunityTokenType) {
|
||||||
community, _ := s.createCommunity()
|
community, _ := s.createCommunity()
|
||||||
|
|
||||||
createTokenPermission := &requests.CreateCommunityTokenPermission{
|
createTokenPermission := &requests.CreateCommunityTokenPermission{
|
||||||
CommunityID: community.ID(),
|
CommunityID: community.ID(),
|
||||||
Type: permissionType,
|
Type: permissionType,
|
||||||
TokenCriteria: []*protobuf.TokenCriteria{
|
TokenCriteria: []*protobuf.TokenCriteria{
|
||||||
&protobuf.TokenCriteria{
|
{
|
||||||
Type: protobuf.CommunityTokenType_ERC20,
|
Type: tokenType,
|
||||||
ContractAddresses: map[uint64]string{testChainID1: "0x123"},
|
ContractAddresses: map[uint64]string{testChainID1: "0x123"},
|
||||||
Symbol: "TEST",
|
Symbol: "TEST",
|
||||||
AmountInWei: "100000000000000000000",
|
AmountInWei: "100000000000000000000",
|
||||||
@ -1705,23 +1704,31 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivileg
|
|||||||
s.Require().False(checkRoleBasedOnThePermissionType(permissionType, &s.alice.identity.PublicKey, community))
|
s.Require().False(checkRoleBasedOnThePermissionType(permissionType, &s.alice.identity.PublicKey, community))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberAdminRoleInOpenCommunity() {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberAdminRoleInOpenCommunity_ERC20() {
|
||||||
s.testReevaluateMemberPrivilegedRoleInOpenCommunity(protobuf.CommunityTokenPermission_BECOME_ADMIN)
|
s.testReevaluateMemberPrivilegedRoleInOpenCommunity(protobuf.CommunityTokenPermission_BECOME_ADMIN, protobuf.CommunityTokenType_ERC20)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberTokenMasterRoleInOpenCommunity() {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberAdminRoleInOpenCommunity_ERC721() {
|
||||||
s.testReevaluateMemberPrivilegedRoleInOpenCommunity(protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER)
|
s.testReevaluateMemberPrivilegedRoleInOpenCommunity(protobuf.CommunityTokenPermission_BECOME_ADMIN, protobuf.CommunityTokenType_ERC721)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivilegedRoleInClosedCommunity(permissionType protobuf.CommunityTokenPermission_Type) {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberTokenMasterRoleInOpenCommunity_ERC20() {
|
||||||
|
s.testReevaluateMemberPrivilegedRoleInOpenCommunity(protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER, protobuf.CommunityTokenType_ERC20)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberTokenMasterRoleInOpenCommunity_ERC721() {
|
||||||
|
s.testReevaluateMemberPrivilegedRoleInOpenCommunity(protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER, protobuf.CommunityTokenType_ERC721)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivilegedRoleInClosedCommunity(permissionType protobuf.CommunityTokenPermission_Type, tokenType protobuf.CommunityTokenType) {
|
||||||
community, _ := s.createCommunity()
|
community, _ := s.createCommunity()
|
||||||
|
|
||||||
createTokenPermission := &requests.CreateCommunityTokenPermission{
|
createTokenPermission := &requests.CreateCommunityTokenPermission{
|
||||||
CommunityID: community.ID(),
|
CommunityID: community.ID(),
|
||||||
Type: permissionType,
|
Type: permissionType,
|
||||||
TokenCriteria: []*protobuf.TokenCriteria{
|
TokenCriteria: []*protobuf.TokenCriteria{
|
||||||
&protobuf.TokenCriteria{
|
{
|
||||||
Type: protobuf.CommunityTokenType_ERC20,
|
Type: tokenType,
|
||||||
ContractAddresses: map[uint64]string{testChainID1: "0x123"},
|
ContractAddresses: map[uint64]string{testChainID1: "0x123"},
|
||||||
Symbol: "TEST",
|
Symbol: "TEST",
|
||||||
AmountInWei: "100000000000000000000",
|
AmountInWei: "100000000000000000000",
|
||||||
@ -1740,8 +1747,8 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivileg
|
|||||||
CommunityID: community.ID(),
|
CommunityID: community.ID(),
|
||||||
Type: protobuf.CommunityTokenPermission_BECOME_MEMBER,
|
Type: protobuf.CommunityTokenPermission_BECOME_MEMBER,
|
||||||
TokenCriteria: []*protobuf.TokenCriteria{
|
TokenCriteria: []*protobuf.TokenCriteria{
|
||||||
&protobuf.TokenCriteria{
|
{
|
||||||
Type: protobuf.CommunityTokenType_ERC20,
|
Type: tokenType,
|
||||||
ContractAddresses: map[uint64]string{testChainID1: "0x124"},
|
ContractAddresses: map[uint64]string{testChainID1: "0x124"},
|
||||||
Symbol: "TEST2",
|
Symbol: "TEST2",
|
||||||
AmountInWei: "100000000000000000000",
|
AmountInWei: "100000000000000000000",
|
||||||
@ -1876,12 +1883,20 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivileg
|
|||||||
s.Require().False(checkRoleBasedOnThePermissionType(permissionType, &s.alice.identity.PublicKey, community))
|
s.Require().False(checkRoleBasedOnThePermissionType(permissionType, &s.alice.identity.PublicKey, community))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberAdminRoleInClosedCommunity() {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberAdminRoleInClosedCommunity_ERC20() {
|
||||||
s.testReevaluateMemberPrivilegedRoleInClosedCommunity(protobuf.CommunityTokenPermission_BECOME_ADMIN)
|
s.testReevaluateMemberPrivilegedRoleInClosedCommunity(protobuf.CommunityTokenPermission_BECOME_ADMIN, protobuf.CommunityTokenType_ERC20)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberTokenMasterRoleInClosedCommunity() {
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberAdminRoleInClosedCommunity_ERC721() {
|
||||||
s.testReevaluateMemberPrivilegedRoleInClosedCommunity(protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER)
|
s.testReevaluateMemberPrivilegedRoleInClosedCommunity(protobuf.CommunityTokenPermission_BECOME_ADMIN, protobuf.CommunityTokenType_ERC721)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberTokenMasterRoleInClosedCommunity_ERC20() {
|
||||||
|
s.testReevaluateMemberPrivilegedRoleInClosedCommunity(protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER, protobuf.CommunityTokenType_ERC20)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberTokenMasterRoleInClosedCommunity_ERC721() {
|
||||||
|
s.testReevaluateMemberPrivilegedRoleInClosedCommunity(protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER, protobuf.CommunityTokenType_ERC721)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkRoleBasedOnThePermissionType(permissionType protobuf.CommunityTokenPermission_Type, member *ecdsa.PublicKey, community *communities.Community) bool {
|
func checkRoleBasedOnThePermissionType(permissionType protobuf.CommunityTokenPermission_Type, member *ecdsa.PublicKey, community *communities.Community) bool {
|
||||||
|
@ -187,7 +187,7 @@ func (s *TestMessengerProfileShowcase) TestSaveAndGetProfileShowcasePreferences(
|
|||||||
TxTimestamp: 0,
|
TxTimestamp: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
s.collectiblesMock.SetResponse(collectibleID, balances)
|
s.collectiblesMock.SetCollectibleOwnershipResponse(collectibleID, balances)
|
||||||
|
|
||||||
err = s.m.SetProfileShowcasePreferences(request, false)
|
err = s.m.SetProfileShowcasePreferences(request, false)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
@ -258,7 +258,7 @@ func (s *TestMessengerProfileShowcase) TestFailToSaveProfileShowcasePreferencesW
|
|||||||
TxTimestamp: 0,
|
TxTimestamp: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
s.collectiblesMock.SetResponse(collectibleID, balances)
|
s.collectiblesMock.SetCollectibleOwnershipResponse(collectibleID, balances)
|
||||||
|
|
||||||
err = s.m.SetProfileShowcasePreferences(request, false)
|
err = s.m.SetProfileShowcasePreferences(request, false)
|
||||||
s.Require().Equal(errorAccountVisibilityLowerThanCollectible, err)
|
s.Require().Equal(errorAccountVisibilityLowerThanCollectible, err)
|
||||||
@ -441,7 +441,7 @@ func (s *TestMessengerProfileShowcase) TestShareShowcasePreferences() {
|
|||||||
TxTimestamp: 32443424,
|
TxTimestamp: 32443424,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
s.collectiblesMock.SetResponse(collectibleID, balances)
|
s.collectiblesMock.SetCollectibleOwnershipResponse(collectibleID, balances)
|
||||||
|
|
||||||
err = s.m.SetProfileShowcasePreferences(request, false)
|
err = s.m.SetProfileShowcasePreferences(request, false)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user