Skip to content

Commit

Permalink
feat: impelemented test project structure for #40
Browse files Browse the repository at this point in the history
  • Loading branch information
H4ppy-04 committed Apr 10, 2023
1 parent b5e3b42 commit d4b8670
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 0 deletions.
Empty file.
Empty file added tests/Common/test_utils.py
Empty file.
Empty file.
35 changes: 35 additions & 0 deletions tests/Config/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import unittest
from configparser import ConfigParser

class TestConfig(unittest.TestCase):
def setUp(self):
""" Setup is the first method run in the test."""
self.path = os.path.join('Config/logger.ini')

if not os.path.isdir('Logs'):
os.mkdir('Logs')
if not os.path.exists(os.path.join('Logs', 'traceback.log')):
with open(os.path.join('Logs', 'traceback.log'), 'w') as fp:
fp.write("Created traceback.log as part of tests.")
fp.close()

def test_config_exists(self):
self.assertTrue(self.path)

def test_config_is_valid(self):
parser = ConfigParser()
if self.test_config_exists:
parser.read(self.path)

# Check if the required sections are present in the config
self.assertIn('formatters', parser.sections())
self.assertIn('handler_console', parser.sections())

# Check if the required keys are present in the sections
self.assertIn('keys', parser['formatters'])
self.assertIn('level', parser['handler_console'])


if __name__ == "__main__":
unittest.main()
Empty file added tests/Config/test_formatter.py
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit d4b8670

Please sign in to comment.