Add method to fleetDesktopResponse to satisfy the errorer interface (#8457)

This commit is contained in:
Roberto Dip 2022-10-26 16:17:11 -03:00 committed by GitHub
parent b32bfc2988
commit fdcbbaac7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -46,6 +46,8 @@ type fleetDesktopResponse struct {
FailingPolicies *uint `json:"failing_policies_count,omitempty"`
}
func (r fleetDesktopResponse) error() error { return r.Err }
type getFleetDesktopRequest struct {
Token string `url:"token"`
}

View file

@ -135,6 +135,13 @@ func (s *integrationTestSuite) TestDeviceAuthenticatedEndpoints() {
json.NewDecoder(res.Body).Decode(&getHostResp)
res.Body.Close()
require.Nil(t, listPoliciesResp.Policies)
// /device/desktop is not accessible for free endpoints
getDesktopResp := fleetDesktopResponse{}
res = s.DoRawNoAuth("GET", "/api/latest/fleet/device/"+token+"/desktop", nil, http.StatusPaymentRequired)
json.NewDecoder(res.Body).Decode(&getDesktopResp)
res.Body.Close()
require.Nil(t, getDesktopResp.FailingPolicies)
}
// TestDefaultTransparencyURL tests that Fleet Free licensees are restricted to the default transparency url.