Skip to content

Commit 5ada183

Browse files
committed
Add validation tests for existing configs
1 parent d39bca7 commit 5ada183

8 files changed

Lines changed: 18 additions & 9 deletions

File tree

openandroidinstaller/assets/configs/FP2.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ metadata:
22
maintainer: Tobias Sterbak (tsterbak)
33
devicename: Fairphone 2
44
devicecode: FP2
5-
requirements:
65
steps:
76
unlock_bootloader:
87
flash_recovery:

openandroidinstaller/assets/configs/a3y17lte.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ metadata:
22
maintainer: Tobias Sterbak (tsterbak)
33
devicename: Samsung Galaxy A3 (2017)
44
devicecode: a3y17lte
5-
requirements:
6-
- heimdall
75
steps:
86
unlock_bootloader:
97
flash_recovery:

openandroidinstaller/assets/configs/a5xelte.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ metadata:
22
maintainer: Tobias Sterbak (tsterbak)
33
devicename: Samsung Galaxy A5 (2016)
44
devicecode: a5xelte
5-
requirements:
6-
- heimdall
75
steps:
86
unlock_bootloader:
97
flash_recovery:

openandroidinstaller/assets/configs/sargo.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ metadata:
22
maintainer: Tobias Sterbak (tsterbak)
33
devicename: Pixel 3a
44
devicecode: sargo
5-
requirements:
65
steps:
76
unlock_bootloader:
87
- title: "Unlock the bootloader"

openandroidinstaller/assets/configs/yuga.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ metadata:
22
maintainer: Tobias Sterbak (tsterbak)
33
devicename: Sony Xperia Z
44
devicecode: yuga
5-
requirements:
65
steps:
76
unlock_bootloader:
87
- title: "Unlock the bootloader"
98
type: confirm_button
109
content: As a first step, you need to unlock the bootloader of your device. On the device, dial *#*#7378423#*#* (*#*#SERVICE#*#*) to launch the service menu.
1110
- title: "Unlock the bootloader"
1211
type: confirm_button
13-
content: Go to service info > configuration and check rooting status - you can only continue if it says 'Bootloader unlock allowed: Yes.'
12+
content: Go to service info > configuration and check rooting status - you can only continue if it says 'Bootloader unlock allowed":" Yes.'
1413
- title: "Unlock the bootloader"
1514
type: confirm_button
1615
content: Connect the device to your PC via USB. And confirm to continue.

openandroidinstaller/installer_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def validate_config(config: str) -> bool:
124124
"devicename": str,
125125
"devicecode": str,
126126
},
127-
"requirements": schema.Or(None, []),
128127
"steps": {
129128
"unlock_bootloader": schema.Or(None, [step_schema]),
130129
"flash_recovery": [step_schema],

tests/conftest.py

Whitespace-only changes.

tests/test_configs.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Test existing config files for schema."""
2+
3+
import pytest
4+
import yaml
5+
from pathlib import Path
6+
from openandroidinstaller.installer_config import validate_config
7+
8+
9+
@pytest.mark.parametrize(
10+
"config_path,valid",
11+
[(path, True) for path in Path("openandroidinstaller/assets/configs").iterdir()],
12+
)
13+
def test_config(config_path: Path, valid: bool):
14+
"""Test if the exisitng configs are valid."""
15+
with open(config_path, "r") as stream:
16+
raw_config = yaml.safe_load(stream)
17+
assert valid == validate_config(raw_config)

0 commit comments

Comments
 (0)