github.com/status-im/status-go@v1.1.0/services/wallet/thirdparty/rarible/client_int_test.go (about)

     1  package rarible
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  	"testing"
     7  	"time"
     8  
     9  	"github.com/ethereum/go-ethereum/common"
    10  
    11  	walletCommon "github.com/status-im/status-go/services/wallet/common"
    12  	"github.com/status-im/status-go/services/wallet/thirdparty"
    13  
    14  	"github.com/stretchr/testify/assert"
    15  	"github.com/stretchr/testify/suite"
    16  )
    17  
    18  func TestRaribleClientIntegrationSuite(t *testing.T) {
    19  	suite.Run(t, new(RaribleClientIntegrationSuite))
    20  }
    21  
    22  type RaribleClientIntegrationSuite struct {
    23  	suite.Suite
    24  
    25  	client *Client
    26  }
    27  
    28  func (s *RaribleClientIntegrationSuite) SetupTest() {
    29  	mainnetKey := os.Getenv("STATUS_BUILD_RARIBLE_MAINNET_API_KEY")
    30  	if mainnetKey == "" {
    31  		mainnetKey = os.Getenv("STATUS_RUNTIME_RARIBLE_MAINNET_API_KEY")
    32  	}
    33  	testnetKey := os.Getenv("STATUS_BUILD_RARIBLE_TESTNET_API_KEY")
    34  	if testnetKey == "" {
    35  		testnetKey = os.Getenv("STATUS_RUNTIME_RARIBLE_TESTNET_API_KEY")
    36  	}
    37  
    38  	s.client = NewClient(mainnetKey, testnetKey)
    39  }
    40  
    41  func (s *RaribleClientIntegrationSuite) TestAPIKeysAvailable() {
    42  	// TODO #13953: Enable for nightly runs
    43  	s.T().Skip("integration test")
    44  
    45  	assert.NotEmpty(s.T(), s.client.mainnetAPIKey)
    46  	assert.NotEmpty(s.T(), s.client.testnetAPIKey)
    47  }
    48  
    49  func (s *RaribleClientIntegrationSuite) TestSearchCollections() {
    50  	// TODO #13953: Enable for nightly runs
    51  	s.T().Skip("integration test")
    52  
    53  	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
    54  	defer cancel()
    55  
    56  	collections, err := s.client.SearchCollections(
    57  		ctx,
    58  		walletCommon.ChainID(walletCommon.EthereumMainnet),
    59  		"CryptoKitties",
    60  		thirdparty.FetchFromStartCursor,
    61  		10,
    62  	)
    63  	s.Require().NoError(err)
    64  	s.Require().NotNil(collections)
    65  	s.Require().NotEmpty(collections.Items)
    66  }
    67  
    68  func (s *RaribleClientIntegrationSuite) TestSearchCollectibles() {
    69  	// TODO #13953: Enable for nightly runs
    70  	s.T().Skip("integration test")
    71  
    72  	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
    73  	defer cancel()
    74  
    75  	collectibles, err := s.client.SearchCollectibles(
    76  		ctx,
    77  		walletCommon.ChainID(walletCommon.EthereumMainnet),
    78  		[]common.Address{common.HexToAddress("0x06012c8cf97BEaD5deAe237070F9587f8E7A266d")},
    79  		"Furbeard",
    80  		thirdparty.FetchFromStartCursor,
    81  		10,
    82  	)
    83  	s.Require().NoError(err)
    84  	s.Require().NotNil(collectibles)
    85  	s.Require().NotEmpty(collectibles.Items)
    86  }