status-go/t/e2e/whisper/whisper_ext_test.go
Dmitry Shulyak be9c55bc16
Accounts data management (#1530)
* WIP accounts implementation

* Accounts datasore and changes to status mobile API

* Add library changes and method to update config

* Handle error after account selection

* Add two methods to start account to backend

* Use encrypted database for settings and add a service for them

* Resolve linter warning

* Bring back StartNode StopNode for tests

* Add sub accounts and get/save api

* Changes to accounts structure

* Login use root address and fetch necessary info from database

* Cover accounts store with tests

* Refactor in progress

* Initialize status keystore instance before starting ethereum node

* Rework library tests

* Resolve failures in private api test and send transaction test

* Pass pointer to initialized config to unmarshal

* Use multiaccounts/accounts naming consistently

Multiaccount is used as a login identifier
Account references an address and a key, if account is not watch-only.

* Add login timestamp stored in the database to accounts.Account object

* Add photo-path field for multiaccount struct

* Add multiaccoutns rpc with updateAccount method

Update to any other account that wasn't used for login will return an error

* Fix linter in services/accounts

* Select account before starting a node

* Save list of accounts on first login

* Pass account manager to accounts service to avoid selecting account before starting a node

* Add logs to login with save and regualr login
2019-08-20 18:38:40 +03:00

45 lines
939 B
Go

package whisper
import (
"fmt"
"io/ioutil"
"os"
"testing"
"github.com/status-im/status-go/node"
"github.com/status-im/status-go/t/utils"
"github.com/stretchr/testify/suite"
)
func TestWhisperExtensionSuite(t *testing.T) {
suite.Run(t, new(WhisperExtensionSuite))
}
type WhisperExtensionSuite struct {
suite.Suite
nodes []*node.StatusNode
}
func (s *WhisperExtensionSuite) SetupTest() {
s.nodes = make([]*node.StatusNode, 2)
for i := range s.nodes {
dir, err := ioutil.TempDir("", "test-shhext-")
s.NoError(err)
// network id is irrelevant
cfg, err := utils.MakeTestNodeConfigWithDataDir(fmt.Sprintf("test-shhext-%d", i), dir, 777)
s.Require().NoError(err)
s.nodes[i] = node.New()
s.Require().NoError(s.nodes[i].Start(cfg, nil))
}
}
func (s *WhisperExtensionSuite) TearDown() {
for _, n := range s.nodes {
cfg := n.Config()
s.NotNil(cfg)
s.NoError(n.Stop())
s.NoError(os.Remove(cfg.DataDir))
}
}