2022-12-09 00:13:10 +01:00
|
|
|
package test
|
|
|
|
|
2023-01-16 18:53:22 +01:00
|
|
|
import (
|
|
|
|
tt "blackforestbytes.com/simplecloudnotifier/test/util"
|
|
|
|
"fmt"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCreateCompatUser(t *testing.T) {
|
|
|
|
_, baseUrl, stop := tt.StartSimpleWebserver(t)
|
|
|
|
defer stop()
|
|
|
|
|
|
|
|
r0 := tt.RequestGet[gin.H](t, baseUrl, fmt.Sprintf("/api/register.php?fcm_token=%s&pro=%s&pro_token=%s", "DUMMY_FCM", "0", ""))
|
|
|
|
|
|
|
|
tt.AssertEqual(t, "success", true, r0["success"])
|
|
|
|
|
|
|
|
userid := int64(r0["user_id"].(float64))
|
|
|
|
userkey := r0["user_key"].(string)
|
|
|
|
|
|
|
|
r1 := tt.RequestGet[gin.H](t, baseUrl, fmt.Sprintf("/api/info.php?user_id=%d&user_key=%s", userid, userkey))
|
|
|
|
|
|
|
|
tt.AssertEqual(t, "success", true, r1["success"])
|
|
|
|
}
|
|
|
|
|
2022-12-09 00:13:10 +01:00
|
|
|
//TODO test compat methods
|
2023-01-14 00:48:51 +01:00
|
|
|
|
|
|
|
//TODO also test compat_id mapping
|