A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/django/django/commit/be8237c7cce24b06aabde0b97afce98ddabbe3b6 below:

[3.2.x] Fixed CVE-2021-23336 -- Fixed web cache poisoning via django.… · django/django@be8237c · GitHub

@@ -363,8 +363,8 @@ def test(self):

363 363 364 364 365 365

# TODO: Remove when dropping support for PY37. Backport of unit tests for

366 -

# urllib.parse.parse_qsl() from Python 3.8. Copyright (C) 2020 Python Software

367 -

# Foundation (see LICENSE.python).

366 +

# urllib.parse.parse_qsl() from Python 3.8.8. Copyright (C) 2021 Python

367 +

# Software Foundation (see LICENSE.python).

368 368

class ParseQSLBackportTests(unittest.TestCase):

369 369

def test_parse_qsl(self):

370 370

tests = [

@@ -388,16 +388,10 @@ def test_parse_qsl(self):

388 388

(b'&a=b', [(b'a', b'b')]),

389 389

(b'a=a+b&b=b+c', [(b'a', b'a b'), (b'b', b'b c')]),

390 390

(b'a=1&a=2', [(b'a', b'1'), (b'a', b'2')]),

391 -

(';', []),

392 -

(';;', []),

393 -

(';a=b', [('a', 'b')]),

394 -

('a=a+b;b=b+c', [('a', 'a b'), ('b', 'b c')]),

395 -

('a=1;a=2', [('a', '1'), ('a', '2')]),

396 -

(b';', []),

397 -

(b';;', []),

398 -

(b';a=b', [(b'a', b'b')]),

399 -

(b'a=a+b;b=b+c', [(b'a', b'a b'), (b'b', b'b c')]),

400 -

(b'a=1;a=2', [(b'a', b'1'), (b'a', b'2')]),

391 +

(';a=b', [(';a', 'b')]),

392 +

('a=a+b;b=b+c', [('a', 'a b;b=b c')]),

393 +

(b';a=b', [(b';a', b'b')]),

394 +

(b'a=a+b;b=b+c', [(b'a', b'a b;b=b c')]),

401 395

]

402 396

for original, expected in tests:

403 397

with self.subTest(original):

@@ -422,6 +416,27 @@ def test_parse_qsl_encoding(self):

422 416

def test_parse_qsl_max_num_fields(self):

423 417

with self.assertRaises(ValueError):

424 418

parse_qsl('&'.join(['a=a'] * 11), max_num_fields=10)

425 -

with self.assertRaises(ValueError):

426 -

parse_qsl(';'.join(['a=a'] * 11), max_num_fields=10)

427 419

parse_qsl('&'.join(['a=a'] * 10), max_num_fields=10)

420 + 421 +

def test_parse_qsl_separator(self):

422 +

tests = [

423 +

(';', []),

424 +

(';;', []),

425 +

('=;a', []),

426 +

(';a=b', [('a', 'b')]),

427 +

('a=a+b;b=b+c', [('a', 'a b'), ('b', 'b c')]),

428 +

('a=1;a=2', [('a', '1'), ('a', '2')]),

429 +

(b';', []),

430 +

(b';;', []),

431 +

(b';a=b', [(b'a', b'b')]),

432 +

(b'a=a+b;b=b+c', [(b'a', b'a b'), (b'b', b'b c')]),

433 +

(b'a=1;a=2', [(b'a', b'1'), (b'a', b'2')]),

434 +

]

435 +

for original, expected in tests:

436 +

with self.subTest(original):

437 +

result = parse_qsl(original, separator=';')

438 +

self.assertEqual(result, expected, 'Error parsing %r' % original)

439 + 440 +

def test_parse_qsl_bad_separator(self):

441 +

with self.assertRaisesRegex(ValueError, 'Separator must be of type string or bytes.'):

442 +

parse_qsl('a=b0c=d', separator=0)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4