generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
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,51 @@ | ||
import os | ||
import sys | ||
|
||
from sacro import logging | ||
|
||
|
||
def test_get_appdir_on_unknown_os(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "unknown") | ||
assert "." == logging.get_appdir() | ||
|
||
|
||
def test_get_log_filename_on_win32(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "win32") | ||
assert os.path.join("AppData/Roaming") in logging.get_log_filename() | ||
assert "SACRO" in logging.get_log_filename() | ||
assert "error.log" in logging.get_log_filename() | ||
|
||
|
||
def test_get_log_filename_on_linux(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "linux") | ||
assert ".config" in logging.get_log_filename() | ||
assert "SACRO" in logging.get_log_filename() | ||
assert "error.log" in logging.get_log_filename() | ||
|
||
|
||
def test_get_log_filename_on_macos(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "darwin") | ||
assert os.path.join("Library/Application Support") in logging.get_log_filename() | ||
assert "SACRO" in logging.get_log_filename() | ||
assert "error.log" in logging.get_log_filename() | ||
|
||
|
||
def test_get_audit_filename_on_win32(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "win32") | ||
assert os.path.join("AppData/Roaming") in logging.get_audit_filename() | ||
assert "SACRO" in logging.get_audit_filename() | ||
assert "audit.log" in logging.get_audit_filename() | ||
|
||
|
||
def test_get_audit_filename_on_linux(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "linux") | ||
assert ".config" in logging.get_audit_filename() | ||
assert "SACRO" in logging.get_audit_filename() | ||
assert "audit.log" in logging.get_audit_filename() | ||
|
||
|
||
def test_get_audit_filename_on_macos(monkeypatch): | ||
monkeypatch.setattr(sys, "platform", "darwin") | ||
assert os.path.join("Library/Application Support") in logging.get_audit_filename() | ||
assert "SACRO" in logging.get_audit_filename() | ||
assert "audit.log" in logging.get_audit_filename() |