-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flush out tests and fix issue with set_server_config
- Loading branch information
Showing
3 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,66 @@ | ||
import sys | ||
import difflib | ||
import codexctl | ||
|
||
FAILED = False | ||
|
||
print("Testing set_server_config: ", end="") | ||
result = codexctl.set_server_config( | ||
""" | ||
[General] | ||
|
||
def test_set_server_config(original, expected): | ||
global FAILED | ||
print("Testing set_server_config: ", end="") | ||
result = codexctl.set_server_config(original, "test") | ||
if result == expected: | ||
print("pass") | ||
return | ||
|
||
FAILED = True | ||
print("fail") | ||
for diff in difflib.ndiff(expected.splitlines(), result.splitlines()): | ||
print(f" {diff}") | ||
|
||
|
||
test_set_server_config( | ||
"", | ||
"SERVER=test\n", | ||
) | ||
|
||
test_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] | ||
"""[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") | ||
test_set_server_config( | ||
"""[General] | ||
SERVER=testing | ||
#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 | ||
""", | ||
"""[General] | ||
SERVER=test | ||
#SERVER=testing | ||
#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 | ||
""", | ||
) | ||
|
||
if FAILED: | ||
sys.exit(1) |