diff options
author | zelig <viktor.tron@gmail.com> | 2014-07-04 00:28:27 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-07-04 00:28:27 +0800 |
commit | c64629964fb96e5ddc8aa590abc7cee4b14c8e84 (patch) | |
tree | 10af8ce2f45052f89f46b9377c83e86531dc5f58 /ethwire/client_identity_test.go | |
parent | de2da4fd19b53a541ffbddfa4360ceabef14f1a9 (diff) | |
download | go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.tar go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.tar.gz go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.tar.bz2 go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.tar.lz go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.tar.xz go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.tar.zst go-tangerine-c64629964fb96e5ddc8aa590abc7cee4b14c8e84.zip |
ethwire.ClientIdentity now handles Client info sent in handshake + test
Diffstat (limited to 'ethwire/client_identity_test.go')
-rw-r--r-- | ethwire/client_identity_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ethwire/client_identity_test.go b/ethwire/client_identity_test.go new file mode 100644 index 000000000..f3c8bfd50 --- /dev/null +++ b/ethwire/client_identity_test.go @@ -0,0 +1,30 @@ +package ethwire + +import ( + "fmt" + "runtime" + "testing" +) + +func TestClientIdentity(t *testing.T) { + clientIdentity := NewSimpleClientIdentity("Ethereum(G)", "0.5.16", "test") + clientString := clientIdentity.String() + expected := fmt.Sprintf("Ethereum(G)/v0.5.16/test/%s/Go", runtime.GOOS) + if clientString != expected { + t.Error("Expected clientIdentity to be %v, got %v", expected, clientString) + } + customIdentifier := clientIdentity.GetCustomIdentifier() + if customIdentifier != "test" { + t.Error("Expected clientIdentity.GetCustomIdentifier() to be 'test', got %v", customIdentifier) + } + clientIdentity.SetCustomIdentifier("test2") + customIdentifier = clientIdentity.GetCustomIdentifier() + if customIdentifier != "test2" { + t.Error("Expected clientIdentity.GetCustomIdentifier() to be 'test2', got %v", customIdentifier) + } + clientString = clientIdentity.String() + expected = fmt.Sprintf("Ethereum(G)/v0.5.16/test2/%s/Go", runtime.GOOS) + if clientString != expected { + t.Error("Expected clientIdentity to be %v, got %v", expected, clientString) + } +} |