forked from pixee/codemodder-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_program.py
More file actions
45 lines (40 loc) · 1.34 KB
/
test_program.py
File metadata and controls
45 lines (40 loc) · 1.34 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import subprocess
from core_codemods.remove_assertion_in_pytest_raises import (
RemoveAssertionInPytestRaises,
)
class TestProgramFails:
def test_no_project_dir_provided(self):
completed_process = subprocess.run(["codemodder"], check=False)
assert completed_process.returncode == 3
def test_codemods_include_exclude_conflict(self):
completed_process = subprocess.run(
[
"codemodder",
"some/path",
"--output",
"doesntmatter.txt",
"--codemod-exclude",
"secure-random",
"--codemod-include",
"secure-random",
],
check=False,
)
assert completed_process.returncode == 3
def test_load_sast_only_by_flag(self, tmp_path):
tmp_file_path = tmp_path / "sonar.json"
tmp_file_path.touch()
completed_process = subprocess.run(
[
"codemodder",
"tests/samples/",
"--sonar-issues-json",
f"{tmp_file_path}",
"--dry-run",
],
check=False,
capture_output=True,
text=True,
)
assert completed_process.returncode == 0
assert RemoveAssertionInPytestRaises.id not in completed_process.stdout