This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeleteAccountResponseAlwaysContainsIntFields(t *testing.T) {
|
||||
data, err := json.Marshal(DeleteAccountResponse{
|
||||
Success: true,
|
||||
Message: "ok",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("failed to marshal response: %v", err)
|
||||
}
|
||||
|
||||
var decoded map[string]interface{}
|
||||
if err = json.Unmarshal(data, &decoded); err != nil {
|
||||
t.Fatalf("failed to decode response: %v", err)
|
||||
}
|
||||
|
||||
userID, hasUserID := decoded["user_id"]
|
||||
if !hasUserID {
|
||||
t.Fatalf("expected user_id in JSON, got %s", string(data))
|
||||
}
|
||||
if userID != float64(0) {
|
||||
t.Fatalf("expected user_id=0, got %v", userID)
|
||||
}
|
||||
|
||||
code, hasCode := decoded["code"]
|
||||
if !hasCode {
|
||||
t.Fatalf("expected code in JSON, got %s", string(data))
|
||||
}
|
||||
if code != float64(0) {
|
||||
t.Fatalf("expected code=0, got %v", code)
|
||||
}
|
||||
}
|
||||
@@ -458,6 +458,7 @@ type CreateSubscribeRequest struct {
|
||||
SpeedLimit int64 `json:"speed_limit"`
|
||||
DeviceLimit int64 `json:"device_limit"`
|
||||
Quota int64 `json:"quota"`
|
||||
NewUserOnly *bool `json:"new_user_only"`
|
||||
Nodes []int64 `json:"nodes"`
|
||||
NodeTags []string `json:"node_tags"`
|
||||
Show *bool `json:"show"`
|
||||
@@ -2402,6 +2403,7 @@ type Subscribe struct {
|
||||
SpeedLimit int64 `json:"speed_limit"`
|
||||
DeviceLimit int64 `json:"device_limit"`
|
||||
Quota int64 `json:"quota"`
|
||||
NewUserOnly bool `json:"new_user_only"`
|
||||
Nodes []int64 `json:"nodes"`
|
||||
NodeTags []string `json:"node_tags"`
|
||||
Show bool `json:"show"`
|
||||
@@ -2805,6 +2807,7 @@ type UpdateSubscribeRequest struct {
|
||||
SpeedLimit int64 `json:"speed_limit"`
|
||||
DeviceLimit int64 `json:"device_limit"`
|
||||
Quota int64 `json:"quota"`
|
||||
NewUserOnly *bool `json:"new_user_only"`
|
||||
Nodes []int64 `json:"nodes"`
|
||||
NodeTags []string `json:"node_tags"`
|
||||
Show *bool `json:"show"`
|
||||
|
||||
Reference in New Issue
Block a user