forked from pixee/codemodder-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_https_connection.py
More file actions
25 lines (22 loc) · 1.37 KB
/
Copy pathtest_https_connection.py
File metadata and controls
25 lines (22 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from codemodder.codemods.test import (
BaseIntegrationTest,
original_and_expected_from_code_path,
)
from core_codemods.https_connection import HTTPSConnection
class TestHTTPSConnection(BaseIntegrationTest):
codemod = HTTPSConnection
code_path = "tests/samples/http_connection.py"
original_code, expected_new_code = original_and_expected_from_code_path(
code_path,
[
(2, ""),
(4, 'urllib3.HTTPSConnectionPool("localhost", "80")\n'),
(5, 'urllib3.connectionpool.HTTPSConnectionPool("localhost", "80")\n'),
(6, 'urllib3.HTTPSConnectionPool("localhost", "80")\n'),
(7, 'pool.HTTPSConnectionPool("localhost", "80")\n'),
],
)
expected_diff = '--- \n+++ \n@@ -1,8 +1,7 @@\n import urllib3\n import urllib3.connectionpool as pool\n-from urllib3 import HTTPConnectionPool as something\n \n-urllib3.HTTPConnectionPool("localhost", "80")\n-urllib3.connectionpool.HTTPConnectionPool("localhost", "80")\n-something("localhost", "80")\n-pool.HTTPConnectionPool("localhost", "80")\n+urllib3.HTTPSConnectionPool("localhost", "80")\n+urllib3.connectionpool.HTTPSConnectionPool("localhost", "80")\n+urllib3.HTTPSConnectionPool("localhost", "80")\n+pool.HTTPSConnectionPool("localhost", "80")\n'
expected_line_change = "5"
num_changes = 4
change_description = HTTPSConnection.change_description