mirror of
https://github.com/lutris/lutris
synced 2024-11-02 11:48:38 +00:00
725368a8dc
The URLs can now have a 3-part path, like this: "lutris:rungame/fear/F.E.A.R. Extraction Point" The third part- which can only exist if the action is also present- is the name of a launch config. We use the config name as there's no launch config "slug" to use. I also added unquoting to the URL, so "F.E.A.R.%20Extraction Point" will work too.
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
from unittest import TestCase
|
|
|
|
from lutris.api import parse_installer_url
|
|
|
|
|
|
class TestInstallerUrls(TestCase):
|
|
def test_legacy_url(self):
|
|
result = parse_installer_url("lutris:quake")
|
|
self.assertEqual(result['game_slug'], 'quake')
|
|
self.assertEqual(result['revision'], None)
|
|
self.assertEqual(result['action'], None)
|
|
self.assertEqual(result['launch_config_name'], None)
|
|
|
|
def test_action_rungameid(self):
|
|
result = parse_installer_url("lutris:rungameid/123")
|
|
self.assertEqual(result['game_slug'], '123')
|
|
self.assertEqual(result['revision'], None)
|
|
self.assertEqual(result['action'], 'rungameid')
|
|
self.assertEqual(result['launch_config_name'], None)
|
|
|
|
def test_action_rungame(self):
|
|
result = parse_installer_url("lutris:rungame/quake")
|
|
self.assertEqual(result['game_slug'], 'quake')
|
|
self.assertEqual(result['revision'], None)
|
|
self.assertEqual(result['action'], 'rungame')
|
|
self.assertEqual(result['launch_config_name'], None)
|
|
|
|
def test_action_rungame_launch_config(self):
|
|
result = parse_installer_url("lutris:rungame/quake/OpenGL%20Edition")
|
|
self.assertEqual(result['game_slug'], 'quake')
|
|
self.assertEqual(result['revision'], None)
|
|
self.assertEqual(result['action'], 'rungame')
|
|
self.assertEqual(result['launch_config_name'], 'OpenGL Edition')
|