Move handlers into ./handlers

This commit is contained in:
Alex Ellis
2017-01-25 22:29:17 +00:00
parent 381556a1e1
commit 501e813d41
9 changed files with 233 additions and 153 deletions

View File

@ -0,0 +1,27 @@
package tests
import (
"testing"
"io/ioutil"
"github.com/alexellis/faas/gateway/handlers"
"github.com/alexellis/faas/gateway/requests"
)
func TestIsAlexa(t *testing.T) {
requestBody, _ := ioutil.ReadFile("./alexhostname_request.json")
var result requests.AlexaRequestBody
result = handlers.IsAlexa(requestBody)
if len(result.Session.Application.ApplicationId) == 0 {
t.Fail()
}
if len(result.Session.SessionId) == 0 {
t.Fail()
}
if len(result.Request.Intent.Name) == 0 {
t.Fail()
}
}