-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_reporter.py
49 lines (31 loc) · 1.42 KB
/
test_reporter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import unittest
import reporter
from os import path, environ, remove
class TestReporter(unittest.TestCase):
def __init__(self, methodName = "runTest"):
super().__init__(methodName)
environ['LOG_DIR'] = "/home/matvey/Documents/Work/ADAM-Server/Reporting/modules/test_files"
def test_report_with_single_date_generated_when_start_and_end_equal(self):
start: str = "2025-04-17"
end: str = "2025-04-17"
reporter.report(start=start, end=end)
self.assertTrue(path.isfile(f"./reports/report-{start}.tex"))
# Delte generated report after testing
remove(f"./reports/report-{start}.tex")
def test_report_with_time_frame_generated_when_start_and_end_are_different(self):
start: str = "2025-04-01"
end: str = "2025-04-17"
reporter.report(start=start, end=end)
self.assertTrue(path.isfile(f"./reports/report-{start}-{end}.tex"))
# Delte generated report after testing
remove(f"./reports/report-{start}-{end}.tex")
def test_full_report_generated_from_earliest_log_to_latest_log(self):
start: str = "2025-04-06"
end: str = "2025-04-17"
""
reporter.report(full=True)
self.assertTrue(path.isfile(f"./reports/report-{start}-{end}.tex"))
# Delte generated report after testing
remove(f"./reports/report-{start}-{end}.tex")
if __name__ == '__main__':
unittest.main()