(t *testing.T)
| 1043 | } |
| 1044 | |
| 1045 | func TestDeviceDelete(t *testing.T) { |
| 1046 | err := adp.DeviceDelete(types.ParseUserId("usr"+testData.Users[1].Id), testData.Devs[0].DeviceId) |
| 1047 | if err != nil { |
| 1048 | t.Fatal(err) |
| 1049 | } |
| 1050 | var count int |
| 1051 | err = db.QueryRow(ctx, "SELECT COUNT(*) FROM devices WHERE userid=$1 AND deviceid=$2", |
| 1052 | decodeUid(testData.Users[1].Id), testData.Devs[0].DeviceId).Scan(&count) |
| 1053 | if err != nil { |
| 1054 | t.Fatal(err) |
| 1055 | } |
| 1056 | if count != 0 { |
| 1057 | t.Error("Device not deleted:", count) |
| 1058 | } |
| 1059 | |
| 1060 | err = adp.DeviceDelete(types.ParseUserId("usr"+testData.Users[2].Id), "") |
| 1061 | if err != nil { |
| 1062 | t.Fatal(err) |
| 1063 | } |
| 1064 | err = db.QueryRow(ctx, "SELECT COUNT(*) FROM devices WHERE userid=$1", |
| 1065 | decodeUid(testData.Users[2].Id)).Scan(&count) |
| 1066 | if err != nil { |
| 1067 | t.Fatal(err) |
| 1068 | } |
| 1069 | if count != 0 { |
| 1070 | t.Error("All devices not deleted:", count) |
| 1071 | } |
| 1072 | } |
| 1073 | |
| 1074 | // ================== Persistent Cache tests ====================== |
| 1075 | func TestPCacheUpsert(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…