/* Rating system designed to be used in VoIP Carriers World Copyright (C) 2013 ITsysCOM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see */ package sessionmanager import ( "testing" ) func TestEventCreation(t *testing.T) { body := `Event-Name: RE_SCHEDULE Core-UUID: 792e181c-b6e6-499c-82a1-52a778e7d82d FreeSWITCH-Hostname: h1.ip-switch.net FreeSWITCH-Switchname: h1.ip-switch.net FreeSWITCH-IPv4: 88.198.12.156 FreeSWITCH-IPv6: %3A%3A1 Event-Date-Local: 2012-10-05%2013%3A41%3A38 Event-Date-GMT: Fri,%2005%20Oct%202012%2011%3A41%3A38%20GMT Event-Date-Timestamp: 1349437298012866 Event-Calling-File: switch_scheduler.c Event-Calling-Function: switch_scheduler_execute Event-Calling-Line-Number: 65 Event-Sequence: 34263 Task-ID: 2 Task-Desc: heartbeat Task-Group: core Task-Runtime: 1349437318` ev := new(FSEvent).New(body) if ev.GetName() != "RE_SCHEDULE" { t.Error("Event not parsed correctly: ", ev) } l := len(ev.(FSEvent)) if l != 17 { t.Error("Incorrect number of event fields: ", l) } }