-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
168 additions
and
18 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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import pytest | ||
|
||
from protontricks.steam import SteamApp | ||
|
||
from pathlib import Path | ||
|
||
|
||
class TestSteamApp: | ||
def test_steam_app_from_appmanifest(self, steam_app_factory, steam_dir): | ||
""" | ||
Create a SteamApp from an appmanifest file | ||
""" | ||
steam_app = steam_app_factory(name="Fake game", appid=10) | ||
|
||
appmanifest_path = \ | ||
Path(steam_app.install_path).parent.parent / "appmanifest_10.acf" | ||
|
||
steam_app = SteamApp.from_appmanifest( | ||
path=str(appmanifest_path), | ||
steam_lib_paths=[str(steam_dir / "steam" / "steamapps")] | ||
) | ||
|
||
assert steam_app.name == "Fake game" | ||
assert steam_app.appid == 10 | ||
|
||
def test_steam_app_from_appmanifest_invalid(self, steam_app_factory): | ||
steam_app = steam_app_factory(name="Fake game", appid=10) | ||
|
||
appmanifest_path = \ | ||
Path(steam_app.install_path).parent.parent / "appmanifest_10.acf" | ||
appmanifest_path.write_text("invalid") | ||
|
||
# Invalid appmanifest file is ignored | ||
assert not SteamApp.from_appmanifest( | ||
path=str(appmanifest_path), | ||
steam_lib_paths=[] | ||
) | ||
|
||
def test_steam_app_from_appmanifest_empty(self, steam_app_factory): | ||
steam_app = steam_app_factory(name="Fake game", appid=10) | ||
|
||
appmanifest_path = \ | ||
Path(steam_app.install_path).parent.parent / "appmanifest_10.acf" | ||
appmanifest_path.write_text("") | ||
|
||
# Empty appmanifest file is ignored | ||
assert not SteamApp.from_appmanifest( | ||
path=str(appmanifest_path), | ||
steam_lib_paths=[] | ||
) |