@@ -76,6 +76,11 @@ func TestBuildDashboardData(t *testing.T) {
7676 accounts : accounts ,
7777 sysKey : sys ,
7878 logs : logs ,
79+ keys : []model.PublicKey {
80+ {ID : 1 , Algorithm : "ssh-ed25519" , IsGlobal : true },
81+ {ID : 2 , Algorithm : "ssh-ed25519" , IsGlobal : false },
82+ {ID : 3 , Algorithm : "ssh-rsa" , IsGlobal : true },
83+ },
7984 }
8085
8186 out , err := BuildDashboardData (store )
@@ -92,8 +97,15 @@ func TestBuildDashboardData(t *testing.T) {
9297 if out .HostsUpToDate != 1 || out .HostsOutdated != 1 {
9398 t .Fatalf ("unexpected hosts up-to-date/outdated: %d/%d" , out .HostsUpToDate , out .HostsOutdated )
9499 }
95- // Note: PublicKeyCount and GlobalKeyCount are commented out in DashboardData
96- // Remove these assertions as they test fields that no longer exist
100+ if out .PublicKeyCount != 3 {
101+ t .Fatalf ("expected 3 public keys, got %d" , out .PublicKeyCount )
102+ }
103+ if out .GlobalKeyCount != 2 {
104+ t .Fatalf ("expected 2 global keys, got %d" , out .GlobalKeyCount )
105+ }
106+ if out .AlgoCounts ["ssh-ed25519" ] != 2 || out .AlgoCounts ["ssh-rsa" ] != 1 {
107+ t .Fatalf ("unexpected algorithm counts: %#v" , out .AlgoCounts )
108+ }
97109 if out .SystemKeySerial != 100 {
98110 t .Fatalf ("expected system key serial 100, got %d" , out .SystemKeySerial )
99111 }
0 commit comments