From 3ab2f6af63feee3db5478b39c5d207a23c28465d Mon Sep 17 00:00:00 2001 From: Daniel Aloni Date: Tue, 26 Sep 2023 15:58:05 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Add=20tests=20for=20`LatestKeysUplo?= =?UTF-8?q?adTs`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clientapi/clientapi_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/clientapi/clientapi_test.go b/clientapi/clientapi_test.go index 7202fd62fc..2bd7eb7911 100644 --- a/clientapi/clientapi_test.go +++ b/clientapi/clientapi_test.go @@ -1667,6 +1667,24 @@ func TestKeys(t *testing.T) { if err != nil { t.Fatal(err) } + dataReq := uapi.QueryAccountDataRequest{ + UserID: alice.ID, + DataType: "account_data", + RoomID: "", + } + res := uapi.QueryAccountDataResponse{} + if err = userAPI.QueryAccountData(processCtx.Context(), &dataReq, &res); err != nil { + t.Fatal(err) + } + var accoundData uapi.AccountData + err = json.Unmarshal(res.GlobalAccountData["account_data"], &accoundData) + if err != nil { + t.Fatal(err) + } + if accoundData.LatestKeysUploadTs == 0 || + time.Now().UnixMilli()-accoundData.LatestKeysUploadTs > 5*time.Second.Milliseconds() { + t.Fatal(err) + } // tests `/keys/query` dev, err := oc.GetOrFetchDevice(ctx, id.UserID(alice.ID), id.DeviceID(accessTokens[alice].deviceID))