Tests[CompatRegisterPro]
This commit is contained in:
@@ -308,6 +308,25 @@ func TestCompatRegister(t *testing.T) {
|
||||
|
||||
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"])
|
||||
tt.AssertEqual(t, "message", "New user registered", r0["message"])
|
||||
tt.AssertEqual(t, "quota", 0, r0["quota"])
|
||||
tt.AssertEqual(t, "quota_max", 50, r0["quota_max"])
|
||||
tt.AssertEqual(t, "is_pro", 0, r0["is_pro"])
|
||||
}
|
||||
|
||||
func TestCompatRegisterPro(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", "true", url.QueryEscape("PURCHASED:000")))
|
||||
tt.AssertEqual(t, "success", true, r0["success"])
|
||||
tt.AssertEqual(t, "message", "New user registered", r0["message"])
|
||||
tt.AssertEqual(t, "quota", 0, r0["quota"])
|
||||
tt.AssertEqual(t, "quota_max", 1000, r0["quota_max"])
|
||||
tt.AssertEqual(t, "is_pro", 1, r0["is_pro"])
|
||||
|
||||
r1 := tt.RequestGet[gin.H](t, baseUrl, fmt.Sprintf("/api/register.php?fcm_token=%s&pro=%s&pro_token=%s", "DUMMY_FCM", "true", url.QueryEscape("INVALID")))
|
||||
tt.AssertEqual(t, "success", false, r1["success"])
|
||||
}
|
||||
|
||||
func TestCompatInfo(t *testing.T) {
|
||||
|
@@ -259,4 +259,30 @@ func TestCreateProUser(t *testing.T) {
|
||||
tt.AssertEqual(t, "is_pro", true, r3["is_pro"])
|
||||
}
|
||||
|
||||
{
|
||||
tt.RequestPostShouldFail(t, baseUrl, "/api/users", gin.H{
|
||||
"agent_model": "DUMMY_PHONE",
|
||||
"agent_version": "4X",
|
||||
"client_type": "ANDROID",
|
||||
"fcm_token": "DUMMY_FCM",
|
||||
"pro_token": "ANDROID|v2|INVALID",
|
||||
}, 400, apierr.INVALID_PRO_TOKEN)
|
||||
|
||||
tt.RequestPostShouldFail(t, baseUrl, "/api/users", gin.H{
|
||||
"agent_model": "DUMMY_PHONE",
|
||||
"agent_version": "4X",
|
||||
"client_type": "ANDROID",
|
||||
"fcm_token": "DUMMY_FCM",
|
||||
"pro_token": "_",
|
||||
}, 400, apierr.INVALID_PRO_TOKEN)
|
||||
|
||||
tt.RequestPostShouldFail(t, baseUrl, "/api/users", gin.H{
|
||||
"agent_model": "DUMMY_PHONE",
|
||||
"agent_version": "4X",
|
||||
"client_type": "ANDROID",
|
||||
"fcm_token": "DUMMY_FCM",
|
||||
"pro_token": "ANDROID|v99|xxx",
|
||||
}, 400, apierr.INVALID_PRO_TOKEN)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user