Skip to content

Commit

Permalink
added to the integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
kelindar committed Jan 27, 2019
1 parent b625b03 commit 829fe3c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/broker/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,32 @@ func TestPubsub(t *testing.T) {
assert.Equal(t, mqtt.TypeOfUnsuback, pkt.Type())
}

{ // Create a private link
msg := mqtt.Publish{
Header: &mqtt.StaticHeader{QOS: 0},
Topic: []byte("emitter/link/"),
Payload: []byte(`{ "name": "hi", "key": "k44Ss59ZSxg6Zyz39kLwN-2t5AETnGpm", "channel": "a/b/c/", "private": true }`),
}
_, err := msg.EncodeTo(cli)
assert.NoError(t, err)
}

{ // Read the link response
pkt, err := mqtt.DecodePacket(cli)
assert.NoError(t, err)
assert.Equal(t, mqtt.TypeOfPublish, pkt.Type())
}

{ // Publish a message to a link
msg := mqtt.Publish{
Header: &mqtt.StaticHeader{QOS: 0},
Topic: []byte("hi"),
Payload: []byte("hello world"),
}
_, err := msg.EncodeTo(cli)
assert.NoError(t, err)
}

{ // Disconnect from the broker
disconnect := mqtt.Disconnect{}
n, err := disconnect.EncodeTo(cli)
Expand Down

0 comments on commit 829fe3c

Please sign in to comment.