-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration tests for use-secure-protocols
- Loading branch information
1 parent
448a913
commit d287a0a
Showing
5 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
integration_tests/sonar/test_sonar_use_secure_protocols.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from codemodder.codemods.test import SonarIntegrationTest | ||
from core_codemods.sonar.sonar_use_secure_protocols import ( | ||
SonarUseSecureProtocols, | ||
SonarUseSecureProtocolsTransformer, | ||
) | ||
|
||
|
||
class TestSonarUseSecureProtocols(SonarIntegrationTest): | ||
codemod = SonarUseSecureProtocols | ||
code_path = "tests/samples/use_secure_protocols.py" | ||
replacement_lines = [ | ||
( | ||
5, | ||
"""url = "https://example.com"\n""", | ||
), | ||
] | ||
# fmt: off | ||
expected_diff = ( | ||
"""--- \n""" | ||
"""+++ \n""" | ||
"""@@ -2,4 +2,4 @@\n""" | ||
''' import smtplib\n''' | ||
''' import telnetlib\n''' | ||
''' \n''' | ||
'''-url = "http://example.com"\n''' | ||
'''+url = "https://example.com"\n''' | ||
) | ||
# fmt: on | ||
expected_line_change = "5" | ||
change_description = SonarUseSecureProtocolsTransformer.change_description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ftplib | ||
import smtplib | ||
import telnetlib | ||
|
||
url = "http://example.com" |