From 9fcf26ea75392e7503fd787a14e0eae94f8c7d14 Mon Sep 17 00:00:00 2001 From: didier amyot Date: Tue, 7 Jul 2015 21:01:27 -0400 Subject: [PATCH] fixed small bug --- doormen/doormen.go | 5 +++-- doormen/doormen_test.go | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doormen/doormen.go b/doormen/doormen.go index e9a0eed..57b4666 100644 --- a/doormen/doormen.go +++ b/doormen/doormen.go @@ -9,7 +9,8 @@ import ( "strconv" "time" - "github.com/didiercrunch/doorman/shared" + client "github.com/didiercrunch/doorman/shared" + "github.com/didiercrunch/doormanserver/shared" ) type DoormanValue struct { @@ -128,7 +129,7 @@ func (dmd *DoormanDefinition) CanBeUpdatedBy(dmd2 *DoormanDefinition) error { } func (dmd *DoormanDefinition) AsDoormanUpdatePayload() ([]byte, error) { - wu := &shared.DoormanUpdater{Id: dmd.Id.Hex()} + wu := &client.DoormanUpdater{Id: shared.ObjectIdToPublicId(dmd.Id)} wu.Timestamp = time.Now().Unix() wu.Probabilities = make([]*big.Rat, len(dmd.Values)) for i, value := range dmd.Values { diff --git a/doormen/doormen_test.go b/doormen/doormen_test.go index 93b62a2..525b4fe 100644 --- a/doormen/doormen_test.go +++ b/doormen/doormen_test.go @@ -5,7 +5,8 @@ import ( "math/big" "testing" - "github.com/didiercrunch/doorman/shared" + client "github.com/didiercrunch/doorman/shared" + "github.com/didiercrunch/doormanserver/shared" "gopkg.in/mgo.v2/bson" ) @@ -101,11 +102,11 @@ func TestAsDoormanUpdatePayload(t *testing.T) { t.Error(err) return } - wu := &shared.DoormanUpdater{} + wu := &client.DoormanUpdater{} if err := json.Unmarshal(data, wu); err != nil { t.Error(err) } - if wd.Id.Hex() != wu.Id { + if shared.ObjectIdToPublicId(wd.Id) != wu.Id { t.Error("bad id", wu.Id) } if len(wu.Probabilities) != 2 {