-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
57d5556
commit 2f09c93
Showing
7 changed files
with
52 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
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,24 @@ | ||
import logging | ||
import os | ||
import sys | ||
|
||
from django.test import TestCase | ||
|
||
|
||
class LoggingTest(TestCase): | ||
def setUp(self): | ||
LOGGING_FOLDER_DEFAULT = os.path.abspath(os.path.join("/logging/")) | ||
self.logger = logging.getLogger("django") | ||
self.log_file = os.path.join(LOGGING_FOLDER_DEFAULT, "debug.log") | ||
|
||
def test_log_file_created(self): | ||
"""Test if the log file is created.""" | ||
self.logger.error("This is a test error message.") | ||
|
||
self.assertTrue(os.path.exists(self.log_file)) | ||
|
||
def test_log_message(self): | ||
"""Test if the log message is written to the file.""" | ||
with open(self.log_file, "r") as f: | ||
content = f.read() | ||
self.assertIn("This is a test error message.", content) |
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