feat: migrate Flutter to Cupertino with daily logs and computer groups
This commit is contained in:
1 parent
c568749d23
commit
87e1fff59b
22 files changed
+808
-55
No files matched your search
@@ -150,3 +150,29 @@ func TestAgentDisconnectReleasesOwnership(t *testing.T) {
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientDeviceListIncludesComputerName(t *testing.T) {
|
||||
b, base := testServer(t)
|
||||
b.mu.Lock()
|
||||
b.agents["phone"] = &agent{id: "phone", ws: &websocket.Conn{}}
|
||||
b.managers["host"] = &manager{ws: &websocket.Conn{}, status: managedStatus{Name: "Office PC", Hostname: "desktop", Devices: []managedDevice{{ID: "phone"}}}}
|
||||
b.mu.Unlock()
|
||||
req, _ := http.NewRequest("GET", base+"/v1/devices", nil)
|
||||
req.Header.Set("Authorization", "Bearer "+testClientToken)
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var rows []struct {
|
||||
ID string `json:"id"`
|
||||
Agent string `json:"agent_id"`
|
||||
Computer string `json:"computer_name"`
|
||||
}
|
||||
if err = json.NewDecoder(resp.Body).Decode(&rows); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(rows) != 1 || rows[0].Agent != "host" || rows[0].Computer != "Office PC" {
|
||||
t.Fatalf("wrong computer association: %+v", rows)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user