diff options
author | Janos Guljas <janos@resenje.org> | 2018-02-09 19:23:30 +0800 |
---|---|---|
committer | Janos Guljas <janos@resenje.org> | 2018-02-22 21:23:17 +0800 |
commit | a3a07350dcef0ba39829a20d8ddba4bd3463d293 (patch) | |
tree | 100f2515cadd92105537a12e6981fab2193435ee /contracts/ens/ens_test.go | |
parent | 820cf09c98706f71d4b02b6c25e62db15830f3fb (diff) | |
parent | 1a4e68721a901e86322631fed1191025a6d14c52 (diff) | |
download | go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.gz go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.zst go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.zip |
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Diffstat (limited to 'contracts/ens/ens_test.go')
-rw-r--r-- | contracts/ens/ens_test.go | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/contracts/ens/ens_test.go b/contracts/ens/ens_test.go index 5faa9b1ad..0016f47db 100644 --- a/contracts/ens/ens_test.go +++ b/contracts/ens/ens_test.go @@ -22,6 +22,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/contracts/ens/contract" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" ) @@ -36,27 +37,36 @@ var ( func TestENS(t *testing.T) { contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(1000000000)}}) transactOpts := bind.NewKeyedTransactor(key) - // Workaround for bug estimating gas in the call to Register - transactOpts.GasLimit = big.NewInt(1000000) - ens, err := DeployENS(transactOpts, contractBackend) + ensAddr, ens, err := DeployENS(transactOpts, contractBackend) if err != nil { - t.Fatalf("expected no error, got %v", err) + t.Fatalf("can't deploy root registry: %v", err) } contractBackend.Commit() - _, err = ens.Register(name) - if err != nil { - t.Fatalf("expected no error, got %v", err) + // Set ourself as the owner of the name. + if _, err := ens.Register(name); err != nil { + t.Fatalf("can't register: %v", err) } contractBackend.Commit() - _, err = ens.SetContentHash(name, hash) + // Deploy a resolver and make it responsible for the name. + resolverAddr, _, _, err := contract.DeployPublicResolver(transactOpts, contractBackend, ensAddr) if err != nil { - t.Fatalf("expected no error, got %v", err) + t.Fatalf("can't deploy resolver: %v", err) + } + if _, err := ens.SetResolver(ensNode(name), resolverAddr); err != nil { + t.Fatalf("can't set resolver: %v", err) + } + contractBackend.Commit() + + // Set the content hash for the name. + if _, err = ens.SetContentHash(name, hash); err != nil { + t.Fatalf("can't set content hash: %v", err) } contractBackend.Commit() + // Try to resolve the name. vhost, err := ens.Resolve(name) if err != nil { t.Fatalf("expected no error, got %v", err) |