Ejemplo n.º 1
0
// Region handles the higher level business processing for this API Call
func Region(controller *bc.BaseController, region string) {
	defer bc.CatchPanic(controller, "Region")

	tracelog.STARTEDf(controller.UserId, "Region", "Region[%s]", region)

	buoyStations, err := buoyService.FindRegion(&controller.Service, region)
	if err != nil {
		tracelog.COMPLETED_ERRORf(err, controller.UserId, "Region", "Region[%s]", region)
		controller.ServeError(err)
		return
	}

	controller.Data["json"] = &buoyStations
	controller.ServeJson()

	tracelog.COMPLETED(controller.UserId, "Region")
}
Ejemplo n.º 2
0
// Test_Region checks the region service call is working
func Test_Region(t *testing.T) {
	service := Prepare()
	defer Finish(service)

	region := "Gulf Of Mexico"

	buoyStations, err := buoyService.FindRegion(service, region)

	Convey("Subject: Test Region Service", t, func() {
		Convey("Should Be Able To Perform A Search", func() {
			So(err, ShouldEqual, nil)
		})
		Convey("Should Have Region Data", func() {
			So(len(buoyStations), ShouldBeGreaterThan, 0)
		})
	})
}