Note about difference between iOS and macOS Responses in comments.

Handle iOS response to InstalledApplicationList
Empty test for duplicate applications regression
Update management service test to fit new signature for NewService()
This commit is contained in:
Mosen
2016-07-18 18:10:44 +10:00
parent 3038d179ec
commit db7c43141d
3 changed files with 22 additions and 2 deletions

View File

@@ -35,6 +35,9 @@ type service struct {
commands command.Service
}
// Acknowledge a response from a device.
// NOTE: IOS devices do not always include the key `RequestType` in their response. Only the presence of the
// result key can be used to identify the response (or the command UUID)
func (svc service) Acknowledge(ctx context.Context, req mdm.Response) (int, error) {
switch req.RequestType {
case "DeviceInformation":
@@ -53,6 +56,12 @@ func (svc service) Acknowledge(ctx context.Context, req mdm.Response) (int, erro
return 0, err
}
}
if req.InstalledApplicationList != nil {
if err := svc.ackInstalledApplicationList(req); err != nil {
return 0, err
}
}
}
total, err := svc.commands.DeleteCommand(req.UDID, req.CommandUUID)

View File

@@ -148,3 +148,8 @@ func TestAckInstalledApplicationList(t *testing.T) {
t.Errorf("there were unfulfilled expectations: %s", err)
}
}
// TODO: A regression exists where a device reports the installed application list twice and apps are duplicated.
func TestAckInstalledApplicationListDuplicateRegression(t *testing.T) {
}

View File

@@ -12,6 +12,7 @@ import (
"github.com/go-kit/kit/log"
"github.com/jmoiron/sqlx"
"github.com/micromdm/dep"
"github.com/micromdm/micromdm/applications"
"github.com/micromdm/micromdm/device"
"github.com/micromdm/micromdm/workflow"
"golang.org/x/net/context"
@@ -327,7 +328,12 @@ func newServer(t *testing.T) (*httptest.Server, Service) {
t.Fatal(err)
}
svc := NewService(ds, ps, dc, nil)
as, err := applications.NewDB("postgres", testConn, logger)
if err != nil {
t.Fatal(err)
}
svc := NewService(ds, ps, dc, nil, as)
handler := ServiceHandler(ctx, svc, logger)
server := httptest.NewServer(handler)
return server, svc
@@ -438,7 +444,7 @@ func TestFetchDEPDevices(t *testing.T) {
if err != nil {
t.Fatal(err)
}
svc := NewService(ds, nil, dc, nil)
svc := NewService(ds, nil, dc, nil, nil)
handler := ServiceHandler(ctx, svc, logger)
server := httptest.NewServer(handler)
defer server.Close()