Skip to content

Commit

Permalink
Add the testing for grpc format
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchiu committed Jun 2, 2018
1 parent ee32fae commit 7da2c11
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions messages/messages_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package messages

import (
"github.com/golang/protobuf/jsonpb"
"github.com/stretchr/testify/assert"
"testing"
)

func TestUnmarshalAddPortRequestJson(t *testing.T) {
j := `
{
"bridgeName":"br0",
"ifaceName" :"eth"
}
`
req := AddPortRequest{}
err := jsonpb.UnmarshalString(j, &req)
assert.NoError(t, err)
}

func TestUnmarshalDeletePortRequestJson(t *testing.T) {
j := `
{
"bridgeName":"br0",
"ifaceName" :"eth"
}
`
req := DeletePortRequest{}
err := jsonpb.UnmarshalString(j, &req)
assert.NoError(t, err)
}

func TestUnmarshalAddFlowRequestJson(t *testing.T) {
j := `
{
"bridgeName":"br0",
"flowString" :"ip,tcp,action=drop"
}
`
req := AddFlowRequest{}
err := jsonpb.UnmarshalString(j, &req)
assert.NoError(t, err)
}

func TestUnmarshalDeleteFlowRequestJson(t *testing.T) {
j := `
{
"bridgeName":"br0",
"flowString" :"ip,tcp,action=drop"
}
`
req := DeleteFlowRequest{}
err := jsonpb.UnmarshalString(j, &req)
assert.NoError(t, err)
}

0 comments on commit 7da2c11

Please sign in to comment.