0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-09-24 18:49:01 +02:00
synapse/tests/rest/client
Eric Eastwood e3db7b2d81
Sliding Sync: Easier to understand timeline assertions in tests (#17511)
Added `_assertTimelineEqual(...)` because I got fed up trying to
understand the crazy diffs from the standard
`self.assertEqual(...)`/`self.assertListEqual(...)`

Before:
```
[FAIL]
Traceback (most recent call last):
  File "/home/eric/Documents/github/element/synapse/tests/rest/client/sliding_sync/test_rooms_timeline.py", line 103, in test_rooms_limited_initial_sync
    self.assertListEqual(
  File "/usr/lib/python3.12/unittest/case.py", line 1091, in assertListEqual
    self.assertSequenceEqual(list1, list2, msg, seq_type=list)
  File "/usr/lib/python3.12/unittest/case.py", line 1073, in assertSequenceEqual
    self.fail(msg)
twisted.trial.unittest.FailTest: Lists differ: ['$4QcmnzhdazSnDYcYSZCS_6-MWSzM_dN3RC7TRvW0w[95 chars]isM'] != ['$8N1XJ7e-3K_wxAanLVD3v8KQ96_B5Xj4huGkgy4N4[95 chars]nnU']

First differing element 0:
'$4QcmnzhdazSnDYcYSZCS_6-MWSzM_dN3RC7TRvW0wWA'
'$8N1XJ7e-3K_wxAanLVD3v8KQ96_B5Xj4huGkgy4N4-E'

- ['$4QcmnzhdazSnDYcYSZCS_6-MWSzM_dN3RC7TRvW0wWA',
-  '$8N1XJ7e-3K_wxAanLVD3v8KQ96_B5Xj4huGkgy4N4-E',
? ^

+ ['$8N1XJ7e-3K_wxAanLVD3v8KQ96_B5Xj4huGkgy4N4-E',
? ^

-  '$q4PRxQ_pBZkQI1keYuZPTtExQ23DqpUI3-Lxwfj_isM']
+  '$4QcmnzhdazSnDYcYSZCS_6-MWSzM_dN3RC7TRvW0wWA',
+  '$j3Xj-t2F1wH9kUHsI8X5yqS7hkdSyN2owaArfvk8nnU']
```

After:

```
[FAIL]
Traceback (most recent call last):
  File "/home/eric/Documents/github/element/synapse/tests/rest/client/sliding_sync/test_rooms_timeline.py", line 178, in test_rooms_limited_initial_sync
    self._assertTimelineEqual(
  File "/home/eric/Documents/github/element/synapse/tests/rest/client/sliding_sync/test_rooms_timeline.py", line 110, in _assertTimelineEqual
    self._assertListEqual(
  File "/home/eric/Documents/github/element/synapse/tests/rest/client/sliding_sync/test_rooms_timeline.py", line 79, in _assertListEqual
    self.fail(f"{diff_message}\n{message}")
twisted.trial.unittest.FailTest: Items must
Expected items to be in actual ('?' = missing expected items):
 [
   (10, master) $w-BoqW1PQQFU4TzVJW5OIelugxh0mY12wrfw6mbC6D4 (m.room.message) activity4
   (11, master) $sSidTZf1EOQmCVDU4mrH_1-bopMQhwcDUO2IhoemR6M (m.room.message) activity5
?  (12, master) $bgOcc3D-2QSkbk4aBxKVyOOQJGs7ZuncRJwG3cEANZg (m.room.member, @user1:test) join
 ]
Actual ('+' = found expected items):
 [
+  (11, master) $sSidTZf1EOQmCVDU4mrH_1-bopMQhwcDUO2IhoemR6M (m.room.message) activity5
+  (10, master) $w-BoqW1PQQFU4TzVJW5OIelugxh0mY12wrfw6mbC6D4 (m.room.message) activity4
   (9, master) $FmCNyc11YeFwiJ4an7_q6H0LCCjQOKd6UCr5VKeXXUw (m.room.message, None) activity3
 ]
```
2024-08-05 13:20:15 -05:00
..
sliding_sync Sliding Sync: Easier to understand timeline assertions in tests (#17511) 2024-08-05 13:20:15 -05:00
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_account.py Bump mypy from 1.8.0 to 1.9.0 (#17297) 2024-06-13 15:50:10 +01:00
test_account_data.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_auth.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_auth_issuer.py Expose OIDC discovery information under the CSAPI (#16726) 2023-12-06 13:48:09 +00:00
test_capabilities.py Update license headers 2023-11-21 15:29:58 -05:00
test_consent.py Update license headers 2023-11-21 15:29:58 -05:00
test_devices.py Add Sliding Sync /sync/e2ee endpoint for To-Device messages (#17167) 2024-05-23 12:06:16 -05:00
test_directory.py Update license headers 2023-11-21 15:29:58 -05:00
test_ephemeral_message.py Update license headers 2023-11-21 15:29:58 -05:00
test_events.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_filter.py Bump mypy from 1.5.1 to 1.8.0 (#16901) 2024-03-13 17:05:57 +00:00
test_identity.py Update license headers 2023-11-21 15:29:58 -05:00
test_keys.py Enable cross-signing key upload without UIA (#17284) 2024-06-14 11:14:56 +01:00
test_login.py Upgrade locked dependency on Twisted to 24.7.0rc1. (#17502) 2024-07-30 15:23:23 +01:00
test_login_token_request.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_media.py Prepare for authenticated media freeze (#17433) 2024-07-22 10:33:17 +01:00
test_models.py Reorganize Pydantic models and types used in handlers (#17279) 2024-06-10 15:03:50 -05:00
test_mutual_rooms.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_notifications.py Require the 'from' parameter for /notifications be an integer (#17283) 2024-06-19 10:05:39 +01:00
test_password_policy.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_power_levels.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_presence.py Update license headers 2023-11-21 15:29:58 -05:00
test_profile.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_push_rule_attrs.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_read_marker.py Do not refuse to set read_marker if previous event_id is in wrong room (#16990) 2024-03-21 18:43:07 +00:00
test_receipts.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_redactions.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_register.py Send an email if the address is already bound to an user account (#16819) 2024-04-23 16:45:24 +01:00
test_relations.py Stabliize support for MSC3981: recurse /relations (#17023) 2024-04-09 17:11:08 +01:00
test_rendezvous.py MSC4108 implementation (#17056) 2024-04-25 12:50:12 +00:00
test_reporting.py Add report room API (MSC4151) (#17270) 2024-06-12 12:27:46 +02:00
test_retention.py Include user membership on events (#17282) 2024-06-13 21:45:54 +00:00
test_rooms.py Add support for MSC3823 - Account Suspension Part 2 (#17255) 2024-06-24 14:21:22 +01:00
test_sendtodevice.py Add Sliding Sync /sync/e2ee endpoint for To-Device messages (#17167) 2024-05-23 12:06:16 -05:00
test_shadow_banned.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_sync.py Sliding Sync: Split and move tests (#17504) 2024-07-31 12:20:46 -05:00
test_third_party_rules.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_transactions.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_typing.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
test_upgrade_room.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
utils.py Return some room data in Sliding Sync /sync (#17320) 2024-07-02 11:07:05 -05:00