|
23 | 23 | import pytest |
24 | 24 |
|
25 | 25 |
|
26 | | -from conftest import BROWSER_ACCEPT, BROWSER_UA, CRAWLER_UA |
| 26 | +from conftest import BROWSER_UA, CRAWLER_UA |
27 | 27 |
|
28 | 28 | DENIED = "RU" |
29 | 29 | ALLOWED = "US" |
@@ -114,16 +114,30 @@ def _get(client, path, country=None, **kwargs): |
114 | 114 | def test_the_nonce_mask_is_sound(client): |
115 | 115 | """The control for every byte-identical assertion in this file. |
116 | 116 |
|
117 | | - If masking `end_id` were hiding something, two identical requests would |
118 | | - still differ after the mask — and every "byte-identical" test below would |
119 | | - be vacuous. |
| 117 | + Two properties, and neither depends on the Dash version. An earlier |
| 118 | + version of this test asserted that two identical requests DIFFER — true |
| 119 | + on Dash 4.4.1, which stamps a per-request `end_id` nonce, and false on |
| 120 | + 4.4.0, which does not. That made a control test fail on the matrix leg |
| 121 | + pinning the older Dash, for a reason that had nothing to do with geo. |
120 | 122 | """ |
121 | 123 | a, b = client.get("/"), client.get("/") |
122 | | - assert a.text != b.text, ( |
123 | | - "two identical requests are byte-identical — the nonce mask is now " |
124 | | - "unnecessary and should be deleted rather than left hiding changes" |
| 124 | + |
| 125 | + # 1. Sound: masking makes two identical requests compare equal, whether |
| 126 | + # or not this Dash stamps a nonce. |
| 127 | + assert _stable(a.text) == _stable(b.text), ( |
| 128 | + "two identical requests differ even after masking — the byte-" |
| 129 | + "identical assertions below cannot mean anything" |
| 130 | + ) |
| 131 | + |
| 132 | + # 2. Not over-broad: it must NOT equalise genuinely different documents. |
| 133 | + # A mask that swallowed real differences would make every |
| 134 | + # byte-identical test in this file vacuous, which is the failure worth |
| 135 | + # guarding against. |
| 136 | + other = client.get("/getting-started") |
| 137 | + assert _stable(a.text) != _stable(other.text), ( |
| 138 | + "the mask equalises two different pages — it is removing more than " |
| 139 | + "the nonce" |
125 | 140 | ) |
126 | | - assert _stable(a.text) == _stable(b.text) |
127 | 141 |
|
128 | 142 |
|
129 | 143 | @pytest.mark.parametrize("label,path", SURFACES.items(), ids=list(SURFACES)) |
|
0 commit comments