Skip to content

Commit b2e4d24

Browse files
committed
Test for the full app
1 parent 22b1b78 commit b2e4d24

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

tests/test_app.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""Test if the main app starts up."""
2+
3+
# This file is part of OpenAndroidInstaller.
4+
# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of
5+
# the GNU General Public License as published by the Free Software Foundation,
6+
# either version 3 of the License, or (at your option) any later version.
7+
8+
# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY
9+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
12+
# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller.
13+
# If not, see <https://www.gnu.org/licenses/>."""
14+
# Author: Tobias Sterbak
15+
16+
import flet as ft
17+
from openandroidinstaller.openandroidinstaller import main
18+
19+
20+
class MockResult:
21+
def __init__(
22+
self,
23+
):
24+
self.results = "testtesttest"
25+
26+
27+
class MockConn:
28+
def __init__(self):
29+
self.page_name = "Test page"
30+
self.pubsubhub = "Pub"
31+
32+
def send_commands(self, command, other):
33+
return MockResult()
34+
35+
36+
def test_app():
37+
page = ft.Page(conn=MockConn(), session_id=1)
38+
# test if it would start up
39+
main(page=page, test=True, test_config="sargo")
40+
41+
# test if you can go through all views
42+
state = page.controls[0].state
43+
state.load_config(device_code="sargo")
44+
for _ in range(len(state.steps) + 5):
45+
page.controls[0].confirm(None)
46+
assert "SuccessView" in str(page.controls[0].view.controls[0])

0 commit comments

Comments
 (0)