Deleted
Added
test_proxy.py (1467:195fe0a92670) | test_proxy.py (1476:e3f7d7ca6f39) |
---|---|
1import re 2import time 3import socket 4import unittest 5from unit.applications.lang.python import TestApplicationPython 6 7 8class TestProxy(TestApplicationPython): --- 507 unchanged lines hidden (view full) --- 516 517 resp = self.get_http10(headers={'Host': 'localhost', 'X-Len': '11'}) 518 self.assertEqual(len(resp['body']), 10, 'body gt Content-Length 11') 519 520 resp = self.get_http10(headers={'Host': 'localhost', 'X-Len': '15'}) 521 self.assertEqual(len(resp['body']), 10, 'body gt Content-Length 15') 522 523 def test_proxy_invalid(self): | 1import re 2import time 3import socket 4import unittest 5from unit.applications.lang.python import TestApplicationPython 6 7 8class TestProxy(TestApplicationPython): --- 507 unchanged lines hidden (view full) --- 516 517 resp = self.get_http10(headers={'Host': 'localhost', 'X-Len': '11'}) 518 self.assertEqual(len(resp['body']), 10, 'body gt Content-Length 11') 519 520 resp = self.get_http10(headers={'Host': 'localhost', 'X-Len': '15'}) 521 self.assertEqual(len(resp['body']), 10, 'body gt Content-Length 15') 522 523 def test_proxy_invalid(self): |
524 self.assertIn( 525 'error', 526 self.conf([{"action": {"proxy": 'blah'}}], 'routes'), 527 'proxy invalid', 528 ) 529 self.assertIn( 530 'error', 531 self.conf([{"action": {"proxy": '/blah'}}], 'routes'), 532 'proxy invalid 2', 533 ) 534 self.assertIn( 535 'error', 536 self.conf([{"action": {"proxy": 'unix:/blah'}}], 'routes'), 537 'proxy unix invalid 2', 538 ) 539 self.assertIn( 540 'error', 541 self.conf([{"action": {"proxy": 'http://blah'}}], 'routes'), 542 'proxy unix invalid 3', 543 ) 544 self.assertIn( 545 'error', 546 self.conf([{"action": {"proxy": 'http://127.0.0.1'}}], 'routes'), 547 'proxy ipv4 invalid', 548 ) 549 self.assertIn( 550 'error', 551 self.conf([{"action": {"proxy": 'http://127.0.0.1:'}}], 'routes'), 552 'proxy ipv4 invalid 2', 553 ) 554 self.assertIn( 555 'error', 556 self.conf( 557 [{"action": {"proxy": 'http://127.0.0.1:blah'}}], 'routes' 558 ), 559 'proxy ipv4 invalid 3', 560 ) 561 self.assertIn( 562 'error', 563 self.conf( 564 [{"action": {"proxy": 'http://127.0.0.1:-1'}}], 'routes' 565 ), 566 'proxy ipv4 invalid 4', 567 ) 568 self.assertIn( 569 'error', 570 self.conf( 571 [{"action": {"proxy": 'http://127.0.0.1:7080b'}}], 'routes' 572 ), 573 'proxy ipv4 invalid 5', 574 ) 575 self.assertIn( 576 'error', 577 self.conf( 578 [{"action": {"proxy": 'http://[]'}}], 'routes' 579 ), 580 'proxy ipv6 invalid', 581 ) 582 self.assertIn( 583 'error', 584 self.conf( 585 [{"action": {"proxy": 'http://[]:7080'}}], 'routes' 586 ), 587 'proxy ipv6 invalid 2', 588 ) 589 self.assertIn( 590 'error', 591 self.conf( 592 [{"action": {"proxy": 'http://[:]:7080'}}], 'routes' 593 ), 594 'proxy ipv6 invalid 3', 595 ) 596 self.assertIn( 597 'error', 598 self.conf( 599 [{"action": {"proxy": 'http://[::7080'}}], 'routes' 600 ), 601 'proxy ipv6 invalid 4', 602 ) | 524 def check_proxy(proxy): 525 self.assertIn( 526 'error', 527 self.conf([{"action": {"proxy": proxy}}], 'routes'), 528 'proxy invalid', 529 ) |
603 | 530 |
531 check_proxy('blah') 532 check_proxy('/blah') 533 check_proxy('unix:/blah') 534 check_proxy('http://blah') 535 check_proxy('http://127.0.0.1') 536 check_proxy('http://127.0.0.1:') 537 check_proxy('http://127.0.0.1:blah') 538 check_proxy('http://127.0.0.1:-1') 539 check_proxy('http://127.0.0.1:7080b') 540 check_proxy('http://[]') 541 check_proxy('http://[]:7080') 542 check_proxy('http://[:]:7080') 543 check_proxy('http://[::7080') 544 |
|
604 def test_proxy_loop(self): 605 self.skip_alerts.extend( 606 [ 607 r'socket.*failed', 608 r'accept.*failed', 609 r'new connections are not accepted', 610 ] 611 ) --- 26 unchanged lines hidden --- | 545 def test_proxy_loop(self): 546 self.skip_alerts.extend( 547 [ 548 r'socket.*failed', 549 r'accept.*failed', 550 r'new connections are not accepted', 551 ] 552 ) --- 26 unchanged lines hidden --- |