Skip to content

Commit

Permalink
Start adding unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Mar 14, 2024
1 parent c3afa85 commit 510f432
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ $(VENV_BIN_ACTIVATE): requirements.remote.txt requirements.txt

test: $(VENV_BIN_ACTIVATE) .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed
@echo "[info] Running test"
. $(VENV_BIN_ACTIVATE); \
python test.py
if [ -d .venv/mnt ] && mountpoint -q .venv/mnt; then \
umount -ql .venv/mnt; \
fi
Expand Down
37 changes: 37 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import sys
import codexctl

FAILED = False

print("Testing set_server_config: ", end="")
result = codexctl.set_server_config(
"""
[General]
#REMARKABLE_RELEASE_APPID={98DA7DF2-4E3E-4744-9DE6-EC931886ABAB}
#SERVER=https://updates.cloud.remarkable.engineering/service/update2
#GROUP=Prod
#PLATFORM=reMarkable2
REMARKABLE_RELEASE_VERSION=3.9.5.2026
""",
"test",
)
if (
result
== """
[General]
SERVER=test
#REMARKABLE_RELEASE_APPID={98DA7DF2-4E3E-4744-9DE6-EC931886ABAB}
#SERVER=https://updates.cloud.remarkable.engineering/service/update2
#GROUP=Prod
#PLATFORM=reMarkable2
REMARKABLE_RELEASE_VERSION=3.9.5.2026
"""
):
FAILED = True
print("fail")

else:
print("pass")

if FAILED:
sys.exit(1)

0 comments on commit 510f432

Please sign in to comment.