Enable some more bandit checks (#30857)

* Enable B108 (hardcoded tmp dir), address findings

* Enable B602 (subprocess popen with shell), address findings

* Enable B604 (start process with shell), address findings

* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
This commit is contained in:
Ville Skyttä authored and GitHub committed 2020-01-20 18:44:55 +02:00
1 parent 6cf20fc7fa
commit 5e2ba2eb77
21 files changed
+110 -91

No files matched your search

+6 -6
View File
@@ -881,17 +881,17 @@ class TestConfig(unittest.TestCase):
def test_path_with_file(self):
"""Test get_config_path method."""
self.config.config_dir = "/tmp/ha-config"
assert "/tmp/ha-config/test.conf" == self.config.path("test.conf")
self.config.config_dir = "/test/ha-config"
assert "/test/ha-config/test.conf" == self.config.path("test.conf")
def test_path_with_dir_and_file(self):
"""Test get_config_path method."""
self.config.config_dir = "/tmp/ha-config"
assert "/tmp/ha-config/dir/test.conf" == self.config.path("dir", "test.conf")
self.config.config_dir = "/test/ha-config"
assert "/test/ha-config/dir/test.conf" == self.config.path("dir", "test.conf")
def test_as_dict(self):
"""Test as dict."""
self.config.config_dir = "/tmp/ha-config"
self.config.config_dir = "/test/ha-config"
expected = {
"latitude": 0,
"longitude": 0,
@@ -900,7 +900,7 @@ class TestConfig(unittest.TestCase):
"location_name": "Home",
"time_zone": "UTC",
"components": set(),
"config_dir": "/tmp/ha-config",
"config_dir": "/test/ha-config",
"whitelist_external_dirs": set(),
"version": __version__,
"config_source": "default",