|
8 | 8 | from webcompat_kb.main import extract_int_from_field
|
9 | 9 | from webcompat_kb.main import parse_string_to_json
|
10 | 10 | from webcompat_kb.main import parse_datetime_str
|
11 |
| -from webcompat_kb.main import RELATION_CONFIG, LINK_FIELDS |
| 11 | +from webcompat_kb.main import RELATION_CONFIG, LINK_FIELDS, ETP_RELATION_CONFIG |
12 | 12 |
|
13 | 13 | SAMPLE_BUGS = {
|
14 | 14 | item["id"]: item
|
|
203 | 203 | ]
|
204 | 204 | }
|
205 | 205 |
|
| 206 | +SAMPLE_ETP_BUGS = { |
| 207 | + item["id"]: item |
| 208 | + for item in [ |
| 209 | + { |
| 210 | + "url": "https://gothamist.com/", |
| 211 | + "summary": "gothamist.com - The comments are not displayed with ETP set to Strict", |
| 212 | + "id": 1910548, |
| 213 | + "keywords": ["priv-webcompat", "webcompat:site-report"], |
| 214 | + "component": "Privacy: Site Reports", |
| 215 | + "resolution": "", |
| 216 | + "blocks": [1101005], |
| 217 | + "depends_on": [1875061], |
| 218 | + "creation_time": "2024-07-30T07:37:28Z", |
| 219 | + "see_also": ["https://github.com/webcompat/web-bugs/issues/139647"], |
| 220 | + "product": "Web Compatibility", |
| 221 | + "status": "NEW", |
| 222 | + }, |
| 223 | + { |
| 224 | + "see_also": ["https://github.com/webcompat/web-bugs/issues/142250"], |
| 225 | + "id": 1921943, |
| 226 | + "summary": "my.farys.be - Login option is missing with ETP set to STRICT", |
| 227 | + "product": "Web Compatibility", |
| 228 | + "keywords": [ |
| 229 | + "priv-webcompat", |
| 230 | + "webcompat:platform-bug", |
| 231 | + "webcompat:site-report", |
| 232 | + ], |
| 233 | + "status": "NEW", |
| 234 | + "resolution": "", |
| 235 | + "component": "Privacy: Site Reports", |
| 236 | + "blocks": [], |
| 237 | + "depends_on": [1101005, 1797458], |
| 238 | + "creation_time": "2024-10-01T08:50:58Z", |
| 239 | + "url": "https://my.farys.be/myfarys/", |
| 240 | + }, |
| 241 | + { |
| 242 | + "see_also": [], |
| 243 | + "summary": "ryanair.com - The form to start a chat does not load with ETP set to STRICT", |
| 244 | + "id": 1928102, |
| 245 | + "product": "Web Compatibility", |
| 246 | + "status": "NEW", |
| 247 | + "keywords": ["webcompat:site-report"], |
| 248 | + "blocks": [], |
| 249 | + "component": "Privacy: Site Reports", |
| 250 | + "resolution": "", |
| 251 | + "depends_on": [1101005, 1122334], |
| 252 | + "url": "https://www.ryanair.com/gb/en/lp/chat", |
| 253 | + "creation_time": "2024-10-30T15:04:41Z", |
| 254 | + }, |
| 255 | + ] |
| 256 | +} |
| 257 | + |
| 258 | +SAMPLE_ETP_DEPENDENCIES_BUGS = { |
| 259 | + item["id"]: item |
| 260 | + for item in [ |
| 261 | + { |
| 262 | + "blocks": [ |
| 263 | + 1526695, |
| 264 | + 1903311, |
| 265 | + 1903317, |
| 266 | + 1903340, |
| 267 | + 1903345, |
| 268 | + ], |
| 269 | + "resolution": "", |
| 270 | + "status": "NEW", |
| 271 | + "see_also": [ |
| 272 | + "https://webcompat.com/issues/2999", |
| 273 | + "https://webcompat.com/issues/10020", |
| 274 | + "https://github.com/webcompat/web-bugs/issues/23536", |
| 275 | + "https://github.com/webcompat/web-bugs/issues/23241", |
| 276 | + "https://github.com/webcompat/web-bugs/issues/23527", |
| 277 | + "https://github.com/webcompat/web-bugs/issues/23000", |
| 278 | + "https://github.com/webcompat/web-bugs/issues/21661", |
| 279 | + "https://github.com/webcompat/web-bugs/issues/22735", |
| 280 | + "https://webcompat.com/issues/23474", |
| 281 | + "https://github.com/webcompat/web-bugs/issues/23460", |
| 282 | + "https://github.com/webcompat/web-bugs/issues/24002", |
| 283 | + "https://webcompat.com/issues/23470", |
| 284 | + "https://webcompat.com/issues/24519", |
| 285 | + "https://github.com/webcompat/web-bugs/issues/25315", |
| 286 | + "https://github.com/webcompat/web-bugs/issues/26073", |
| 287 | + "https://github.com/webcompat/web-bugs/issues/27976", |
| 288 | + "https://github.com/webcompat/web-bugs/issues/28052#event-2248891646", |
| 289 | + "https://github.com/webcompat/web-bugs/issues/28425", |
| 290 | + "https://github.com/webcompat/web-bugs/issues/29218", |
| 291 | + "https://webcompat.com/issues/20266", |
| 292 | + "https://github.com/webcompat/web-bugs/issues/30320", |
| 293 | + "https://webcompat.com/issues/38315", |
| 294 | + "https://webcompat.com/issues/35647", |
| 295 | + ], |
| 296 | + "creation_time": "2014-11-18T16:11:29Z", |
| 297 | + "summary": "[meta] ETP Strict mode or Private Browsing mode tracking protection breakage", |
| 298 | + "url": "", |
| 299 | + "id": 1101005, |
| 300 | + "component": "Privacy: Anti-Tracking", |
| 301 | + "depends_on": [ |
| 302 | + 1400025, |
| 303 | + 1446243, |
| 304 | + 1465962, |
| 305 | + 1470298, |
| 306 | + 1470301, |
| 307 | + 1486425, |
| 308 | + 1627322, |
| 309 | + ], |
| 310 | + "keywords": ["meta", "webcompat:platform-bug"], |
| 311 | + "product": "Core", |
| 312 | + }, |
| 313 | + { |
| 314 | + "status": "NEW", |
| 315 | + "resolution": "", |
| 316 | + "blocks": [1101005, 1773684, 1921943], |
| 317 | + "summary": "[meta] Email Tracking Breakage", |
| 318 | + "creation_time": "2022-10-26T09:33:25Z", |
| 319 | + "see_also": [], |
| 320 | + "component": "Privacy: Anti-Tracking", |
| 321 | + "url": "", |
| 322 | + "id": 1797458, |
| 323 | + "product": "Core", |
| 324 | + "keywords": ["meta"], |
| 325 | + "depends_on": [ |
| 326 | + 1796560, |
| 327 | + 1799094, |
| 328 | + 1799618, |
| 329 | + 1800007, |
| 330 | + 1803127, |
| 331 | + ], |
| 332 | + }, |
| 333 | + { |
| 334 | + "status": "NEW", |
| 335 | + "resolution": "", |
| 336 | + "creation_time": "2024-01-17T13:40:16Z", |
| 337 | + "see_also": [ |
| 338 | + "https://bugzilla.mozilla.org/show_bug.cgi?id=1869326", |
| 339 | + "https://bugzilla.mozilla.org/show_bug.cgi?id=1872855", |
| 340 | + "https://bugzilla.mozilla.org/show_bug.cgi?id=1874855", |
| 341 | + "https://bugzilla.mozilla.org/show_bug.cgi?id=1878855", |
| 342 | + "https://bugzilla.mozilla.org/show_bug.cgi?id=1428122", |
| 343 | + "https://bugzilla.mozilla.org/show_bug.cgi?id=1892176", |
| 344 | + ], |
| 345 | + "url": "", |
| 346 | + "keywords": ["meta"], |
| 347 | + "product": "Core", |
| 348 | + "depends_on": [1884676, 1906418, 1894615], |
| 349 | + "blocks": [ |
| 350 | + 1101005, |
| 351 | + 1901474, |
| 352 | + 1905920, |
| 353 | + 1906053, |
| 354 | + 1910548, |
| 355 | + 1910855, |
| 356 | + 1912261, |
| 357 | + 1916183, |
| 358 | + 1916443, |
| 359 | + ], |
| 360 | + "summary": "[meta] ETP breakage for webpages that have Disqus comment section", |
| 361 | + "component": "Privacy: Anti-Tracking", |
| 362 | + "id": 1875061, |
| 363 | + }, |
| 364 | + { |
| 365 | + "status": "NEW", |
| 366 | + "resolution": "", |
| 367 | + "creation_time": "2024-01-17T13:40:16Z", |
| 368 | + "see_also": [], |
| 369 | + "url": "", |
| 370 | + "keywords": [], |
| 371 | + "product": "Core", |
| 372 | + "depends_on": [444444, 555555], |
| 373 | + "blocks": [], |
| 374 | + "summary": "Sample non meta ETP dependency", |
| 375 | + "component": "Privacy: Anti-Tracking", |
| 376 | + "id": 1122334, |
| 377 | + }, |
| 378 | + ] |
| 379 | +} |
| 380 | + |
206 | 381 | SAMPLE_CORE_AS_KB_BUGS = {
|
207 | 382 | item["id"]: item
|
208 | 383 | for item in [
|
@@ -1530,3 +1705,79 @@ def test_convert_bug_data(bz):
|
1530 | 1705 | def test_parse_datetime():
|
1531 | 1706 | result = parse_datetime_str("2024-06-11T16:35:50Z")
|
1532 | 1707 | assert result == datetime(2024, 6, 11, 16, 35, 50, tzinfo=timezone.utc)
|
| 1708 | + |
| 1709 | + |
| 1710 | +def test_unify_etp_dependencies(bz): |
| 1711 | + unified_etp_bugs = bz.unify_etp_dependencies( |
| 1712 | + SAMPLE_ETP_BUGS, SAMPLE_ETP_DEPENDENCIES_BUGS |
| 1713 | + ) |
| 1714 | + |
| 1715 | + assert unified_etp_bugs == { |
| 1716 | + item["id"]: item |
| 1717 | + for item in [ |
| 1718 | + { |
| 1719 | + "url": "https://gothamist.com/", |
| 1720 | + "summary": "gothamist.com - The comments are not displayed with ETP set to Strict", |
| 1721 | + "id": 1910548, |
| 1722 | + "keywords": ["priv-webcompat", "webcompat:site-report"], |
| 1723 | + "component": "Privacy: Site Reports", |
| 1724 | + "resolution": "", |
| 1725 | + "blocks": [], |
| 1726 | + "depends_on": [1101005, 1875061], |
| 1727 | + "creation_time": "2024-07-30T07:37:28Z", |
| 1728 | + "see_also": ["https://github.com/webcompat/web-bugs/issues/139647"], |
| 1729 | + "product": "Web Compatibility", |
| 1730 | + "status": "NEW", |
| 1731 | + }, |
| 1732 | + { |
| 1733 | + "see_also": ["https://github.com/webcompat/web-bugs/issues/142250"], |
| 1734 | + "id": 1921943, |
| 1735 | + "summary": "my.farys.be - Login option is missing with ETP set to STRICT", |
| 1736 | + "product": "Web Compatibility", |
| 1737 | + "keywords": [ |
| 1738 | + "priv-webcompat", |
| 1739 | + "webcompat:platform-bug", |
| 1740 | + "webcompat:site-report", |
| 1741 | + ], |
| 1742 | + "status": "NEW", |
| 1743 | + "resolution": "", |
| 1744 | + "component": "Privacy: Site Reports", |
| 1745 | + "blocks": [], |
| 1746 | + "depends_on": [1101005, 1797458], |
| 1747 | + "creation_time": "2024-10-01T08:50:58Z", |
| 1748 | + "url": "https://my.farys.be/myfarys/", |
| 1749 | + }, |
| 1750 | + { |
| 1751 | + "see_also": [], |
| 1752 | + "summary": "ryanair.com - The form to start a chat does not load with ETP set to STRICT", |
| 1753 | + "id": 1928102, |
| 1754 | + "product": "Web Compatibility", |
| 1755 | + "status": "NEW", |
| 1756 | + "keywords": ["webcompat:site-report"], |
| 1757 | + "blocks": [], |
| 1758 | + "component": "Privacy: Site Reports", |
| 1759 | + "resolution": "", |
| 1760 | + "depends_on": [1101005], |
| 1761 | + "url": "https://www.ryanair.com/gb/en/lp/chat", |
| 1762 | + "creation_time": "2024-10-30T15:04:41Z", |
| 1763 | + }, |
| 1764 | + ] |
| 1765 | + } |
| 1766 | + |
| 1767 | + |
| 1768 | +def test_build_etp_relations(bz): |
| 1769 | + unified_etp_bugs = bz.unify_etp_dependencies( |
| 1770 | + SAMPLE_ETP_BUGS, SAMPLE_ETP_DEPENDENCIES_BUGS |
| 1771 | + ) |
| 1772 | + etp_data, _ = bz.process_relations(unified_etp_bugs, ETP_RELATION_CONFIG) |
| 1773 | + etp_rels = bz.build_relations(etp_data, ETP_RELATION_CONFIG) |
| 1774 | + |
| 1775 | + assert etp_rels == { |
| 1776 | + "etp_breakage_reports": [ |
| 1777 | + {"breakage_bug": 1910548, "etp_meta_bug": 1101005}, |
| 1778 | + {"breakage_bug": 1910548, "etp_meta_bug": 1875061}, |
| 1779 | + {"breakage_bug": 1921943, "etp_meta_bug": 1101005}, |
| 1780 | + {"breakage_bug": 1921943, "etp_meta_bug": 1797458}, |
| 1781 | + {"breakage_bug": 1928102, "etp_meta_bug": 1101005}, |
| 1782 | + ] |
| 1783 | + } |
0 commit comments