Browse Source

location message test

master
Patrick Peng Sun 8 years ago
parent
commit
734cf3f667
1 changed files with 15 additions and 9 deletions
  1. +15
    -9
      inMsg_test.go

+ 15
- 9
inMsg_test.go View File

@@ -211,13 +211,19 @@ func TestAcceptLocationInfo(t *testing.T) {
// </xml>

// Decript as:
// <xml><ToUserName><![CDATA[gh_f09231355c68]]></ToUserName>
// <FromUserName><![CDATA[oUN420bxqFqlx0ZQHciUOesZO3PE]]></FromUserName>
// <CreateTime>1493304047</CreateTime>
// <MsgType><![CDATA[event]]></MsgType>
// <Event><![CDATA[LOCATION]]></Event>
// <Latitude>-33.764935</Latitude>
// <Longitude>150.960327</Longitude>
// <Precision>110.000000</Precision>
// </xml>
msg := `
<xml><ToUserName><![CDATA[gh_f09231355c68]]></ToUserName>
<FromUserName><![CDATA[oUN420bxqFqlx0ZQHciUOesZO3PE]]></FromUserName>
<CreateTime>1493304047</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[LOCATION]]></Event>
<Latitude>-33.764935</Latitude>
<Longitude>150.960327</Longitude>
<Precision>110.000000</Precision>
</xml>`
m := ReadEventMsg(msg)
AssertEqual(t, m.Event, "LOCATION", "Expect LOCATION event")
AssertEqual(t, m.Longitude, 150.960327, "Expect 150.960327")
AssertEqual(t, m.Latitude, -33.764935, "Expect -33.764935")
AssertEqual(t, m.Precision, 110.000000, "Expect 110.000000")
}

Loading…
Cancel
Save