mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-13 05:45:41 +08:00
Add basic test for ackInstalledApplicationList
This commit is contained in:
@@ -20,7 +20,11 @@ func (md MockDevices) GetDeviceByUUID(uuid string, fields ...string) (*device.De
|
|||||||
return &device.Device{}, nil
|
return &device.Device{}, nil
|
||||||
}
|
}
|
||||||
func (md MockDevices) Devices(params ...interface{}) ([]device.Device, error) {
|
func (md MockDevices) Devices(params ...interface{}) ([]device.Device, error) {
|
||||||
return []device.Device{}, nil
|
return []device.Device{
|
||||||
|
{
|
||||||
|
UUID: "ABCD-EFGH-IJKL",
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
func (md MockDevices) Save(msg string, dev *device.Device) error {
|
func (md MockDevices) Save(msg string, dev *device.Device) error {
|
||||||
return nil
|
return nil
|
||||||
@@ -86,3 +90,33 @@ func TestAckQueryResponses(t *testing.T) {
|
|||||||
svc := NewService(mockDevices, mockApps, mockCmd)
|
svc := NewService(mockDevices, mockApps, mockCmd)
|
||||||
svc.Acknowledge(MockContext{}, response)
|
svc.Acknowledge(MockContext{}, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAckInstalledApplicationList(t *testing.T) {
|
||||||
|
|
||||||
|
response := mdm.Response{
|
||||||
|
UDID: "00000000-1111-2222-3333-444455556666",
|
||||||
|
Status: "Acknowledged",
|
||||||
|
CommandUUID: "10000000-1111-2222-3333-444455556666",
|
||||||
|
RequestType: "InstalledApplicationList",
|
||||||
|
InstalledApplicationList: []mdm.InstalledApplicationListItem{
|
||||||
|
{
|
||||||
|
Name: "Wireless Network Utility",
|
||||||
|
BundleSize: 2416111,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "Keychain Access",
|
||||||
|
Identifier: "com.apple.keychainaccess",
|
||||||
|
ShortVersion: "9.0",
|
||||||
|
Version: "9.0",
|
||||||
|
BundleSize: 14166172,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
mockDevices := MockDevices{}
|
||||||
|
mockApps := MockApps{}
|
||||||
|
mockCmd := MockCmd{}
|
||||||
|
|
||||||
|
svc := NewService(mockDevices, mockApps, mockCmd)
|
||||||
|
svc.Acknowledge(MockContext{}, response)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user