(t *testing.T)
| 287 | } |
| 288 | |
| 289 | func TestImportAccount(t *testing.T) { |
| 290 | walletPath2 := "tmp.dat" |
| 291 | wallet2, err := NewClientImpl(walletPath2) |
| 292 | if err != nil { |
| 293 | t.Errorf("TestImportAccount NewClientImpl error:%s", err) |
| 294 | return |
| 295 | } |
| 296 | defer os.Remove(walletPath2) |
| 297 | |
| 298 | acc1, err := wallet2.NewAccount("", keypair.PK_ECDSA, keypair.P256, s.SHA256withECDSA, testPasswd) |
| 299 | if err != nil { |
| 300 | t.Errorf("TestImportAccount NewAccount error:%s", err) |
| 301 | return |
| 302 | } |
| 303 | accMetadata := wallet2.GetAccountMetadataByAddress(acc1.Address.ToBase58()) |
| 304 | if accMetadata == nil { |
| 305 | t.Errorf("TestImportAccount GetAccountMetadataByAddress:%s return nil", acc1.Address.ToBase58()) |
| 306 | return |
| 307 | } |
| 308 | err = testWallet.ImportAccount(accMetadata) |
| 309 | if err != nil { |
| 310 | t.Errorf("TestImportAccount ImportAccount error:%s", err) |
| 311 | return |
| 312 | } |
| 313 | |
| 314 | acc, err := testWallet.GetAccountByAddress(accMetadata.Address, testPasswd) |
| 315 | if err != nil { |
| 316 | t.Errorf("TestImportAccount GetAccountByAddress error:%s", err) |
| 317 | return |
| 318 | } |
| 319 | if acc == nil { |
| 320 | t.Errorf("TestImportAccount failed, GetAccountByAddress return nil after import") |
| 321 | return |
| 322 | } |
| 323 | assert.Equal(t, acc.Address.ToBase58() == acc1.Address.ToBase58(), true) |
| 324 | } |
| 325 | |
| 326 | func TestCheckSigScheme(t *testing.T) { |
| 327 | testClient, _ := NewClientImpl("") |
nothing calls this directly
no test coverage detected