-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
64 lines (52 loc) · 2.22 KB
/
test.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: utf-8 -*-
import unittest
from app_controller.tests.test_auth import AuthenticatorTestCase
from app_controller.tests.test_cache import CacheTestCase
from app_controller.tests.test_calendar_exporter import CalendarExporterTestCase
from app_controller.tests.test_course_browser import CourseBrowserTestCase
from app_controller.tests.test_downloader import DownloaderTestCase
from app_controller.tests.test_dumper import DumperTestCase
from app_controller.tests.test_exceptions import ExceptionsTestCase
from app_controller.tests.test_grades_reporter import GradesReporterTestCase
from app_controller.tests.test_logger import LoggerTestCase
def mock_app():
import os
from pathlib import Path
import certifi
os.environ["KIVY_IMAGE"] = "pil,sdl2"
os.environ["SSL_CERT_FILE"] = certifi.where()
from kivy.core.window import Window
Window.size = (720, 1440)
Window.minimum_height = 1000
Window.minimum_width = 600
from app_controller.client_ import Client_ as Client
from app_view.app import MobileApp
from app_view.platform_specs import app_dir_path
app = MobileApp(
Client(
"",
"",
max_len=100,
max_age=60**2,
filepath=__file__,
verbose=True,
destination=str(Path(app_dir_path) / ".cache.dat"),
)
)
app.run()
if __name__ == "__main__":
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTests(loader.loadTestsFromTestCase(AuthenticatorTestCase))
suite.addTests(loader.loadTestsFromTestCase(CacheTestCase))
suite.addTests(loader.loadTestsFromTestCase(CalendarExporterTestCase))
suite.addTests(loader.loadTestsFromTestCase(CourseBrowserTestCase))
suite.addTests(loader.loadTestsFromTestCase(DownloaderTestCase))
suite.addTests(loader.loadTestsFromTestCase(DumperTestCase))
suite.addTests(loader.loadTestsFromTestCase(ExceptionsTestCase))
suite.addTests(loader.loadTestsFromTestCase(GradesReporterTestCase))
suite.addTests(loader.loadTestsFromTestCase(LoggerTestCase))
runner = unittest.TextTestRunner(verbosity=3)
result = runner.run(suite)
if len(result.errors) + len(result.unexpectedSuccesses) == 0:
mock_app()