Skip to content

Commit

Permalink
SporeModManager: add update-modapi test to test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Jul 12, 2024
1 parent 68fdbd7 commit cc43d26
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion SporeModManager/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
sporemodmanager = ''
verbose = False
cleanup = True
network = False

# paths for tests
tests_path = tempfile.mkdtemp()
Expand Down Expand Up @@ -633,6 +634,30 @@ def test_list_installed():
assert b'test_list_installed_0' not in result.stdout
assert result.stderr == b''

# Tests whether update-modapi works correctly
def test_update_modapi():
print(f'Running {test_update_modapi.__name__}...')
reset_smm()

# attempt to update modapi dll
result = run_smm([ 'update-modapi' ])
assert result.returncode == 0
assert result.stdout != b''
assert result.stderr == b''

# ensure mod with higher dll build required works
xml = """<mod displayName="test_list_installed_0"
unique="test_list_installed_0"
description="test_list_installed_0"
installerSystemVersion="1.0.1.1"
dllsBuild="2.5.310">
</mod>"""
write_sporemod(xml)
result = run_smm([ 'install', sporemod_file ])
assert result.returncode == 0
assert result.stdout != b''
assert result.stderr == b''

#
# main
#
Expand All @@ -644,14 +669,16 @@ def test_list_installed():
# add argument parser
parser = argparse.ArgumentParser(description='Runs SporeModManager tests.')
parser.add_argument('--nocleanup', action='store_false', help="skips cleanup of temporary directory")
parser.add_argument('--verbose', action='store_true', help='prints command output for each test.')
parser.add_argument('--verbose', action='store_true', help='prints command output for each test')
parser.add_argument('--network', action='store_true', help='runs tests which require network access')
parser.add_argument('executable', help='executable to run tests with.')
args = parser.parse_args()

# set global variables
sporemodmanager = args.executable
verbose = args.verbose
cleanup = args.nocleanup
network = args.network

# create test directories
os.mkdir(corelibs_path)
Expand All @@ -669,3 +696,5 @@ def test_list_installed():
test_uninstall()
test_update()
test_list_installed()
if network:
test_update_modapi()

0 comments on commit cc43d26

Please sign in to comment.