cleanup test local-url
This commit is contained in:
parent
203360e8b5
commit
0750bf1d8a
@ -8,11 +8,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGetClient(t *testing.T) {
|
func TestGetClient(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -59,11 +57,9 @@ func TestGetClient(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateAndDeleteClient(t *testing.T) {
|
func TestCreateAndDeleteClient(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -104,11 +100,9 @@ func TestCreateAndDeleteClient(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReuseFCM(t *testing.T) {
|
func TestReuseFCM(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
|
@ -12,11 +12,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSearchMessageFTSSimple(t *testing.T) {
|
func TestSearchMessageFTSSimple(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
data := tt.InitDefaultData(t, ws)
|
data := tt.InitDefaultData(t, ws)
|
||||||
|
|
||||||
type mglist struct {
|
type mglist struct {
|
||||||
@ -40,11 +38,9 @@ func TestSearchMessageFTSMulti(t *testing.T) {
|
|||||||
//TODO list messages from channel that you cannot see
|
//TODO list messages from channel that you cannot see
|
||||||
|
|
||||||
func TestDeleteMessage(t *testing.T) {
|
func TestDeleteMessage(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -70,11 +66,9 @@ func TestDeleteMessage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteMessageAndResendUsrMsgId(t *testing.T) {
|
func TestDeleteMessageAndResendUsrMsgId(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -122,11 +116,9 @@ func TestDeleteMessageAndResendUsrMsgId(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetMessageSimple(t *testing.T) {
|
func TestGetMessageSimple(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
data := tt.InitDefaultData(t, ws)
|
data := tt.InitDefaultData(t, ws)
|
||||||
|
|
||||||
msgOut := tt.RequestPost[gin.H](t, baseUrl, "/", gin.H{
|
msgOut := tt.RequestPost[gin.H](t, baseUrl, "/", gin.H{
|
||||||
@ -141,22 +133,18 @@ func TestGetMessageSimple(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetMessageNotFound(t *testing.T) {
|
func TestGetMessageNotFound(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
data := tt.InitDefaultData(t, ws)
|
data := tt.InitDefaultData(t, ws)
|
||||||
|
|
||||||
tt.RequestAuthGetShouldFail(t, data.User[0].AdminKey, baseUrl, "/api/messages/8963586", 404, apierr.MESSAGE_NOT_FOUND)
|
tt.RequestAuthGetShouldFail(t, data.User[0].AdminKey, baseUrl, "/api/messages/8963586", 404, apierr.MESSAGE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetMessageFull(t *testing.T) {
|
func TestGetMessageFull(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
data := tt.InitDefaultData(t, ws)
|
data := tt.InitDefaultData(t, ws)
|
||||||
|
|
||||||
ts := time.Now().Unix() - 735
|
ts := time.Now().Unix() - 735
|
||||||
|
@ -12,13 +12,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSendSimpleMessageJSON(t *testing.T) {
|
func TestSendSimpleMessageJSON(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -67,13 +65,11 @@ func TestSendSimpleMessageJSON(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendSimpleMessageQuery(t *testing.T) {
|
func TestSendSimpleMessageQuery(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -105,13 +101,11 @@ func TestSendSimpleMessageQuery(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendSimpleMessageForm(t *testing.T) {
|
func TestSendSimpleMessageForm(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -147,13 +141,11 @@ func TestSendSimpleMessageForm(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendSimpleMessageFormAndQuery(t *testing.T) {
|
func TestSendSimpleMessageFormAndQuery(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -176,13 +168,11 @@ func TestSendSimpleMessageFormAndQuery(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendSimpleMessageJSONAndQuery(t *testing.T) {
|
func TestSendSimpleMessageJSONAndQuery(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -205,13 +195,11 @@ func TestSendSimpleMessageJSONAndQuery(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendSimpleMessageAlt1(t *testing.T) {
|
func TestSendSimpleMessageAlt1(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -254,13 +242,11 @@ func TestSendSimpleMessageAlt1(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendContentMessage(t *testing.T) {
|
func TestSendContentMessage(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -301,13 +287,11 @@ func TestSendContentMessage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendWithSendername(t *testing.T) {
|
func TestSendWithSendername(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -352,13 +336,11 @@ func TestSendWithSendername(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendLongContent(t *testing.T) {
|
func TestSendLongContent(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -413,11 +395,9 @@ func TestSendLongContent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendTooLongContent(t *testing.T) {
|
func TestSendTooLongContent(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -442,11 +422,9 @@ func TestSendTooLongContent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendTooLongTitle(t *testing.T) {
|
func TestSendTooLongTitle(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -465,13 +443,11 @@ func TestSendTooLongTitle(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendIdempotent(t *testing.T) {
|
func TestSendIdempotent(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -545,13 +521,11 @@ func TestSendIdempotent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendWithPriority(t *testing.T) {
|
func TestSendWithPriority(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -640,13 +614,11 @@ func TestSendWithPriority(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendInvalidPriority(t *testing.T) {
|
func TestSendInvalidPriority(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -760,13 +732,11 @@ func TestSendInvalidPriority(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendWithTimestamp(t *testing.T) {
|
func TestSendWithTimestamp(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -819,13 +789,11 @@ func TestSendWithTimestamp(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendInvalidTimestamp(t *testing.T) {
|
func TestSendInvalidTimestamp(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -924,13 +892,11 @@ func TestSendInvalidTimestamp(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendCompat(t *testing.T) {
|
func TestSendCompat(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
ws, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
pusher := ws.Pusher.(*push.TestSink)
|
pusher := ws.Pusher.(*push.TestSink)
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -1014,11 +980,9 @@ func TestSendCompat(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendToNewChannel(t *testing.T) {
|
func TestSendToNewChannel(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -1096,11 +1060,9 @@ func TestSendToNewChannel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendToManualChannel(t *testing.T) {
|
func TestSendToManualChannel(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -1189,11 +1151,9 @@ func TestSendToManualChannel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendToTooLongChannel(t *testing.T) {
|
func TestSendToTooLongChannel(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
|
@ -9,11 +9,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateUserNoClient(t *testing.T) {
|
func TestCreateUserNoClient(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"no_client": true,
|
"no_client": true,
|
||||||
})
|
})
|
||||||
@ -35,11 +33,9 @@ func TestCreateUserNoClient(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateUserDummyClient(t *testing.T) {
|
func TestCreateUserDummyClient(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -76,11 +72,9 @@ func TestCreateUserDummyClient(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateUserWithUsername(t *testing.T) {
|
func TestCreateUserWithUsername(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -103,11 +97,9 @@ func TestCreateUserWithUsername(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateUsername(t *testing.T) {
|
func TestUpdateUsername(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -139,11 +131,9 @@ func TestUpdateUsername(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecreateKeys(t *testing.T) {
|
func TestRecreateKeys(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
@ -202,11 +192,9 @@ func TestRecreateKeys(t *testing.T) {
|
|||||||
func TestDeleteUser(t *testing.T) {
|
func TestDeleteUser(t *testing.T) {
|
||||||
t.SkipNow() // TODO DeleteUser Not implemented
|
t.SkipNow() // TODO DeleteUser Not implemented
|
||||||
|
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
r0 := tt.RequestPost[gin.H](t, baseUrl, "/api/users", gin.H{
|
||||||
"agent_model": "DUMMY_PHONE",
|
"agent_model": "DUMMY_PHONE",
|
||||||
"agent_version": "4X",
|
"agent_version": "4X",
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
|
|
||||||
type Void = struct{}
|
type Void = struct{}
|
||||||
|
|
||||||
func StartSimpleWebserver(t *testing.T) (*logic.Application, func()) {
|
func StartSimpleWebserver(t *testing.T) (*logic.Application, string, func()) {
|
||||||
InitTests()
|
InitTests()
|
||||||
|
|
||||||
uuid2, _ := langext.NewHexUUID()
|
uuid2, _ := langext.NewHexUUID()
|
||||||
@ -100,5 +100,5 @@ func StartSimpleWebserver(t *testing.T) (*logic.Application, func()) {
|
|||||||
TestFailErr(t, err)
|
TestFailErr(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return app, stop
|
return app, "http://127.0.0.1:" + app.Port, stop
|
||||||
}
|
}
|
||||||
|
@ -7,18 +7,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestWebserver(t *testing.T) {
|
func TestWebserver(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
fmt.Printf("Port := %s\n", ws.Port)
|
fmt.Printf("URL := %s\n", baseUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPing(t *testing.T) {
|
func TestPing(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
_ = tt.RequestGet[tt.Void](t, baseUrl, "/api/ping")
|
_ = tt.RequestGet[tt.Void](t, baseUrl, "/api/ping")
|
||||||
_ = tt.RequestPut[tt.Void](t, baseUrl, "/api/ping", nil)
|
_ = tt.RequestPut[tt.Void](t, baseUrl, "/api/ping", nil)
|
||||||
_ = tt.RequestPost[tt.Void](t, baseUrl, "/api/ping", nil)
|
_ = tt.RequestPost[tt.Void](t, baseUrl, "/api/ping", nil)
|
||||||
@ -27,19 +25,15 @@ func TestPing(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMongo(t *testing.T) {
|
func TestMongo(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
_ = tt.RequestPost[tt.Void](t, baseUrl, "/api/db-test", nil)
|
_ = tt.RequestPost[tt.Void](t, baseUrl, "/api/db-test", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHealth(t *testing.T) {
|
func TestHealth(t *testing.T) {
|
||||||
ws, stop := tt.StartSimpleWebserver(t)
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
|
||||||
|
|
||||||
_ = tt.RequestGet[tt.Void](t, baseUrl, "/api/health")
|
_ = tt.RequestGet[tt.Void](t, baseUrl, "/api/health")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user