mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-04-29 15:47:14 +00:00

* Set 600 premissions on json files * Add test * Fix local tar tests * Fix tar test in action * Use pytest fixture for tmp_path in tests * remove not needed things
21 lines
612 B
Python
21 lines
612 B
Python
"""test json."""
|
|
from supervisor.utils.json import write_json_file
|
|
|
|
|
|
def test_file_permissions(tmp_path):
|
|
"""Test file permissions."""
|
|
tempfile = tmp_path / "test.json"
|
|
write_json_file(tempfile, {"test": "data"})
|
|
assert tempfile.is_file()
|
|
assert oct(tempfile.stat().st_mode)[-3:] == "600"
|
|
|
|
|
|
def test_new_file_permissions(tmp_path):
|
|
"""Test file permissions."""
|
|
tempfile = tmp_path / "test.json"
|
|
tempfile.write_text("test")
|
|
assert oct(tempfile.stat().st_mode)[-3:] != "600"
|
|
|
|
write_json_file(tempfile, {"test": "data"})
|
|
assert oct(tempfile.stat().st_mode)[-3:] == "600"
|