test changes

This commit is contained in:
afeiszli 2021-05-27 17:21:28 -04:00
parent adc8876f9b
commit 8e9a0b46aa
3 changed files with 8 additions and 5 deletions

View file

@ -1 +1 @@
10.0.0.2 myhost.skynet 10.0.0.1 node-thhy9.skynet

View file

@ -61,6 +61,9 @@ type NetworkUpdate struct {
AllowManualSignUp *bool `json:"allowmanualsignup" bson:"allowmanualsignup"` AllowManualSignUp *bool `json:"allowmanualsignup" bson:"allowmanualsignup"`
IsLocal *bool `json:"islocal" bson:"islocal"` IsLocal *bool `json:"islocal" bson:"islocal"`
IsDualStack *bool `json:"isdualstack" bson:"isdualstack"` IsDualStack *bool `json:"isdualstack" bson:"isdualstack"`
IsIPv4 string `json:"isipv4" bson:"isipv4"`
IsIPv6 string `json:"isipv6" bson:"isipv6"`
IsGRPCHub string `json:"isgrpchub" bson:"isgrpchub"`
LocalRange string `json:"localrange" bson:"localrange" validate:"omitempty,cidr"` LocalRange string `json:"localrange" bson:"localrange" validate:"omitempty,cidr"`
//can't have min=1 with omitempty //can't have min=1 with omitempty
DefaultCheckInInterval int32 `json:"checkininterval,omitempty" bson:"checkininterval,omitempty" validate:"omitempty,numeric,min=2,max=100000"` DefaultCheckInInterval int32 `json:"checkininterval,omitempty" bson:"checkininterval,omitempty" validate:"omitempty,numeric,min=2,max=100000"`

View file

@ -277,7 +277,7 @@ func TestDeleteKey(t *testing.T) {
err = json.NewDecoder(response.Body).Decode(&message) err = json.NewDecoder(response.Body).Decode(&message)
assert.Nil(t, err, err) assert.Nil(t, err, err)
assert.Equal(t, http.StatusUnauthorized, message.Code) assert.Equal(t, http.StatusUnauthorized, message.Code)
assert.Contains(t, "ou are unauthorized to access this endpoint", message.Message) assert.Contains(t, message.Message, "ou are unauthorized to access this endpoint")
}) })
} }
@ -302,7 +302,7 @@ func TestGetKeys(t *testing.T) {
var message models.ErrorResponse var message models.ErrorResponse
err = json.NewDecoder(response.Body).Decode(&message) err = json.NewDecoder(response.Body).Decode(&message)
assert.Nil(t, err, err) assert.Nil(t, err, err)
assert.Contains(t, "his network does not exist", message.Message) assert.Contains(t, message.Message, "his network does not exist")
assert.Equal(t, http.StatusNotFound, response.StatusCode) assert.Equal(t, http.StatusNotFound, response.StatusCode)
}) })
t.Run("InvalidCredentials", func(t *testing.T) { t.Run("InvalidCredentials", func(t *testing.T) {
@ -314,7 +314,7 @@ func TestGetKeys(t *testing.T) {
err = json.NewDecoder(response.Body).Decode(&message) err = json.NewDecoder(response.Body).Decode(&message)
assert.Nil(t, err, err) assert.Nil(t, err, err)
assert.Equal(t, http.StatusUnauthorized, message.Code) assert.Equal(t, http.StatusUnauthorized, message.Code)
assert.Contains(t, "ou are unauthorized to access this endpoint", message.Message) assert.Contains(t, message.Message, "ou are unauthorized to access this endpoint")
}) })
} }
@ -352,7 +352,7 @@ func TestUpdateNetwork(t *testing.T) {
err = json.NewDecoder(response.Body).Decode(&message) err = json.NewDecoder(response.Body).Decode(&message)
assert.Nil(t, err, err) assert.Nil(t, err, err)
assert.Equal(t, http.StatusUnauthorized, message.Code) assert.Equal(t, http.StatusUnauthorized, message.Code)
assert.Contains(t, "his network does not exist.", message.Message) assert.Contains(t, message.Message, "his network does not exist.")
assert.Equal(t, http.StatusNotFound, response.StatusCode) assert.Equal(t, http.StatusNotFound, response.StatusCode)
}) })
t.Run("UpdateAddress", func(t *testing.T) { t.Run("UpdateAddress", func(t *testing.T) {