summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_repo_logging.py31
1 files changed, 7 insertions, 24 deletions
diff --git a/tests/test_repo_logging.py b/tests/test_repo_logging.py
index 5402a90b..b51e6270 100644
--- a/tests/test_repo_logging.py
+++ b/tests/test_repo_logging.py
@@ -23,7 +23,6 @@ class TestRepoLogger(unittest.TestCase):
23 def test_error_logs_error(self): 23 def test_error_logs_error(self):
24 """Test if error fn outputs logs.""" 24 """Test if error fn outputs logs."""
25 logger = RepoLogger(__name__) 25 logger = RepoLogger(__name__)
26 RepoLogger.errors[:] = []
27 result = None 26 result = None
28 27
29 def mock_handler(log): 28 def mock_handler(log):
@@ -42,7 +41,6 @@ class TestRepoLogger(unittest.TestCase):
42 def test_warning_logs_error(self): 41 def test_warning_logs_error(self):
43 """Test if warning fn outputs logs.""" 42 """Test if warning fn outputs logs."""
44 logger = RepoLogger(__name__) 43 logger = RepoLogger(__name__)
45 RepoLogger.errors[:] = []
46 result = None 44 result = None
47 45
48 def mock_handler(log): 46 def mock_handler(log):
@@ -58,30 +56,9 @@ class TestRepoLogger(unittest.TestCase):
58 56
59 self.assertEqual(result, "You know the rules and so do I (do I)") 57 self.assertEqual(result, "You know the rules and so do I (do I)")
60 58
61 def test_error_aggregates_error_msg(self):
62 """Test if error fn aggregates error logs."""
63 logger = RepoLogger(__name__)
64 RepoLogger.errors[:] = []
65
66 logger.error("A full commitment's what I'm thinking of")
67 logger.error("You wouldn't get this from any other guy")
68 logger.error("I just wanna tell you how I'm feeling")
69 logger.error("Gotta make you understand")
70
71 self.assertEqual(
72 RepoLogger.errors[:],
73 [
74 "A full commitment's what I'm thinking of",
75 "You wouldn't get this from any other guy",
76 "I just wanna tell you how I'm feeling",
77 "Gotta make you understand",
78 ],
79 )
80
81 def test_log_aggregated_errors_logs_aggregated_errors(self): 59 def test_log_aggregated_errors_logs_aggregated_errors(self):
82 """Test if log_aggregated_errors outputs aggregated errors.""" 60 """Test if log_aggregated_errors outputs aggregated errors."""
83 logger = RepoLogger(__name__) 61 logger = RepoLogger(__name__)
84 RepoLogger.errors[:] = []
85 result = [] 62 result = []
86 63
87 def mock_handler(log): 64 def mock_handler(log):
@@ -96,7 +73,13 @@ class TestRepoLogger(unittest.TestCase):
96 logger.error("Never gonna give you up") 73 logger.error("Never gonna give you up")
97 logger.error("Never gonna let you down") 74 logger.error("Never gonna let you down")
98 logger.error("Never gonna run around and desert you") 75 logger.error("Never gonna run around and desert you")
99 logger.log_aggregated_errors() 76 logger.log_aggregated_errors(
77 [
78 "Never gonna give you up",
79 "Never gonna let you down",
80 "Never gonna run around and desert you",
81 ]
82 )
100 83
101 self.assertEqual( 84 self.assertEqual(
102 result, 85 result,