Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

Commit

Permalink
move TestAgentEntryToJSON to entry_agent_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed May 23, 2018
1 parent 3bbd435 commit 49eaf46
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
31 changes: 31 additions & 0 deletions entry_agent_test.go
@@ -0,0 +1,31 @@
package holochain

import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)

func TestAgentEntryToJSON(t *testing.T) {
a := AgentIdentity("zippy@someemail.com")
a1, _ := NewAgent(LibP2P, a, MakeTestSeed(""))
pk, _ := a1.EncodePubKey()
ae := AgentEntry{
Identity: a,
PublicKey: pk,
}

var j string
var err error
Convey("it should convert to JSON", t, func() {
j, err = ae.ToJSON()
So(err, ShouldBeNil)
So(j, ShouldEqual, `{"Identity":"zippy@someemail.com","Revocation":"","PublicKey":"4XTTM4Lf8pAWo6dfra223t4ZK7gjAjFA49VdwrC1wVHQqb8nH"}`)
})

Convey("it should convert from JSON", t, func() {
ae2, err := AgentEntryFromJSON(j)
So(err, ShouldBeNil)
So(ae2, ShouldResemble, ae)
})

}
25 changes: 0 additions & 25 deletions entry_test.go
Expand Up @@ -116,31 +116,6 @@ func TestMarshalEntry(t *testing.T) {
})
}

func TestAgentEntryToJSON(t *testing.T) {
a := AgentIdentity("zippy@someemail.com")
a1, _ := NewAgent(LibP2P, a, MakeTestSeed(""))
pk, _ := a1.EncodePubKey()
ae := AgentEntry{
Identity: a,
PublicKey: pk,
}

var j string
var err error
Convey("it should convert to JSON", t, func() {
j, err = ae.ToJSON()
So(err, ShouldBeNil)
So(j, ShouldEqual, `{"Identity":"zippy@someemail.com","Revocation":"","PublicKey":"4XTTM4Lf8pAWo6dfra223t4ZK7gjAjFA49VdwrC1wVHQqb8nH"}`)
})

Convey("it should convert from JSON", t, func() {
ae2, err := AgentEntryFromJSON(j)
So(err, ShouldBeNil)
So(ae2, ShouldResemble, ae)
})

}

func TestDelEntryToJSON(t *testing.T) {
hashStr := "QmVGtdTZdTFaLsaj2RwdVG8jcjNNcp1DE914DKZ2kHmXHx"
hash, _ := NewHash(hashStr)
Expand Down

0 comments on commit 49eaf46

Please sign in to comment.