diff --git a/.gitignore b/.gitignore index c525d13..9f744c4 100644 --- a/.gitignore +++ b/.gitignore @@ -142,4 +142,7 @@ cython_debug/ */assets/* # .vscode -.vscode/ \ No newline at end of file +.vscode/ + +# PyCharm .idea +.idea/ \ No newline at end of file diff --git a/test/unit-tests/test_utilities.py b/test/unit-tests/test_utilities.py index c4fac30..d3c62d7 100644 --- a/test/unit-tests/test_utilities.py +++ b/test/unit-tests/test_utilities.py @@ -1,5 +1,10 @@ import unittest -from projectbot.Utilities import is_recongized_difficulty + +from projectbot.Utilities import is_recongized_difficulty, check_file_exists +from projectbot.Utilities import ResponseFormatter +import configparser +from projectbot.Configuration import Configuration + class ReconigzedDifficulty(unittest.TestCase): def test_recnogized_difficulty_all(self): @@ -37,3 +42,18 @@ def test_recnogized_difficulty_uppercase_medium(self): def test_recnogized_difficulty_uppercase_hard(self): is_recognized = is_recongized_difficulty('HARD') self.assertTrue(is_recognized, 'Is not a reconigzed difficulty') +class LinkFormatted(unittest.TestCase): + def test_link_format(self): + parser = Configuration() + parser.init_config_with_ini() + config = parser.config + url = ResponseFormatter(config['repo_url']) + link = url.create_link_reference('Google','https://google.com/') + self.assertEqual(link, '- [Google](https://google.com/)\n', 'Link not formatted') +class FileExists(unittest.TestCase): + def test_does_file_exist(self): + file = check_file_exists('src/bot.py', 'Does not exist') + self.assertTrue(file, "Method is broken!") + def test_does_file_not_exist(self): + file = check_file_exists('abcd', 'No file found') + self.assertFalse(file, 'Method always returns True!') \ No newline at end of file