Registrar and contractInfo handling
* resolver -> common/registrar * global registrar name registry interface * add Call to resolver backend interface * the hashReg and UrlHing contracts now initialised from global registry * initialization of contracts uniform * improve errors and more econsistent method names * common/registrar/ethreg: versioned registrar * integrate new naming and registrar in natspec * js console api: setGlobalRegistrar, setHashReg, setUrlHint * js test TestContract uses mining - tests fixed all pass * eth/backend: allow PoW test mode (small ethash DAG) * console jsre refers to resolver.abi/addr, * cmd/geth/contracts.go moved to common/registrar
This commit is contained in:
@@ -2,6 +2,7 @@ package docserver
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -15,7 +16,7 @@ func TestGetAuthContent(t *testing.T) {
|
||||
copy(hash[:], crypto.Sha3([]byte(text)))
|
||||
ioutil.WriteFile("/tmp/test.content", []byte(text), os.ModePerm)
|
||||
|
||||
ds, err := New("/tmp/")
|
||||
ds := New("/tmp/")
|
||||
content, err := ds.GetAuthContent("file:///test.content", hash)
|
||||
if err != nil {
|
||||
t.Errorf("no error expected, got %v", err)
|
||||
@@ -36,3 +37,18 @@ func TestGetAuthContent(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type rt struct{}
|
||||
|
||||
func (rt) RoundTrip(req *http.Request) (resp *http.Response, err error) { return }
|
||||
|
||||
func TestRegisterScheme(t *testing.T) {
|
||||
ds := New("/tmp/")
|
||||
if ds.HasScheme("scheme") {
|
||||
t.Errorf("expected scheme not to be registered")
|
||||
}
|
||||
ds.RegisterScheme("scheme", rt{})
|
||||
if !ds.HasScheme("scheme") {
|
||||
t.Errorf("expected scheme to be registered")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user