From c0c774a8520aef7758b5b9d074d0c6038d11a50f Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 12 Oct 2023 13:20:34 +0100 Subject: [PATCH 1/2] Fix MSC3890 tests using wrong CSAPI helper Regressed in #665. --- tests/msc3890/msc3890_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/msc3890/msc3890_test.go b/tests/msc3890/msc3890_test.go index 35a4f2c7..655e1693 100644 --- a/tests/msc3890/msc3890_test.go +++ b/tests/msc3890/msc3890_test.go @@ -72,7 +72,7 @@ func TestDeletingDeviceRemovesDeviceLocalNotificationSettings(t *testing.T) { aliceDeviceTwo.MustDo(t, "POST", []string{"_matrix", "client", "v3", "logout"}) // Using the first device, check that the local notification setting account data for the deleted device was removed. - res = aliceDeviceOne.MustGetGlobalAccountData(t, accountDataType) + res = aliceDeviceOne.GetGlobalAccountData(t, accountDataType) must.MatchResponse(t, res, match.HTTPResponse{ StatusCode: 404, JSON: []match.JSON{ From 3abf5ad3d9402305cacf121837435abb449194e0 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 12 Oct 2023 13:23:01 +0100 Subject: [PATCH 2/2] Signposts in MSC3890 tests --- tests/msc3890/msc3890_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/msc3890/msc3890_test.go b/tests/msc3890/msc3890_test.go index 655e1693..43942435 100644 --- a/tests/msc3890/msc3890_test.go +++ b/tests/msc3890/msc3890_test.go @@ -19,12 +19,10 @@ func TestDeletingDeviceRemovesDeviceLocalNotificationSettings(t *testing.T) { deployment := Deploy(t, b.BlueprintCleanHS) defer deployment.Destroy(t) - // Create a user which we can log in to multiple times + t.Log("Alice registers on device 1 and logs in to device 2.") aliceLocalpart := "alice" alicePassword := "hunter2" aliceDeviceOne := deployment.RegisterUser(t, "hs1", aliceLocalpart, alicePassword, false) - - // Log in to another device on this user aliceDeviceTwo := deployment.LoginUser(t, "hs1", aliceLocalpart, alicePassword) accountDataType := "org.matrix.msc3890.local_notification_settings." + aliceDeviceTwo.DeviceID @@ -38,7 +36,7 @@ func TestDeletingDeviceRemovesDeviceLocalNotificationSettings(t *testing.T) { client.SyncReq{}, ) - // Using the first device, create some local notification settings in the user's account data for the second device. + t.Log("Using her first device, Alice creates some local notification settings in her account data for the second device.") aliceDeviceOne.MustSetGlobalAccountData( t, accountDataType, accountDataContent, ) @@ -51,7 +49,7 @@ func TestDeletingDeviceRemovesDeviceLocalNotificationSettings(t *testing.T) { return match.JSONKeyEqual("content", accountDataContent)(r) == nil } - // Check that the content of the user account data for this type has been set successfully + t.Log("Alice syncs on device 1 until she sees the account data she just wrote.") aliceDeviceOne.MustSyncUntil( t, client.SyncReq{ @@ -59,8 +57,8 @@ func TestDeletingDeviceRemovesDeviceLocalNotificationSettings(t *testing.T) { }, client.SyncGlobalAccountDataHas(checkAccountDataContent), ) - // Also check via the dedicated account data endpoint to ensure the similar check later is not 404'ing for some other reason. - // Using `MustDo` ensures that the response code is 2xx. + + t.Log("Alice also checks for the account data she wrote on the dedicated account data endpoint.") res := aliceDeviceOne.MustGetGlobalAccountData(t, accountDataType) must.MatchResponse(t, res, match.HTTPResponse{ JSON: []match.JSON{ @@ -68,10 +66,10 @@ func TestDeletingDeviceRemovesDeviceLocalNotificationSettings(t *testing.T) { }, }) - // Log out the second device + t.Log("Alice logs out her second device.") aliceDeviceTwo.MustDo(t, "POST", []string{"_matrix", "client", "v3", "logout"}) - // Using the first device, check that the local notification setting account data for the deleted device was removed. + t.Log("Alice re-fetches the global account data. The response should now have status 404.") res = aliceDeviceOne.GetGlobalAccountData(t, accountDataType) must.MatchResponse(t, res, match.HTTPResponse{ StatusCode: 404,