mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
Update tests
This commit is contained in:
parent
8fc4cb0134
commit
e667c3a6c3
|
@ -2,6 +2,17 @@ from unittest import TestCase
|
||||||
from lutris.installer.interpreter import ScriptInterpreter
|
from lutris.installer.interpreter import ScriptInterpreter
|
||||||
from lutris.installer.errors import ScriptingError
|
from lutris.installer.errors import ScriptingError
|
||||||
|
|
||||||
|
TEST_INSTALLER = {
|
||||||
|
'script': {
|
||||||
|
'game': 'test'
|
||||||
|
},
|
||||||
|
'version': 'test',
|
||||||
|
'game_slug': 'test',
|
||||||
|
'name': 'test',
|
||||||
|
'slug': 'test',
|
||||||
|
'runner': 'linux'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class MockInterpreter(ScriptInterpreter):
|
class MockInterpreter(ScriptInterpreter):
|
||||||
"""A script interpreter mock."""
|
"""A script interpreter mock."""
|
||||||
|
@ -38,14 +49,14 @@ class TestScriptInterpreter(TestCase):
|
||||||
interpreter._get_move_paths({})
|
interpreter._get_move_paths({})
|
||||||
|
|
||||||
def test_get_command_returns_a_method(self):
|
def test_get_command_returns_a_method(self):
|
||||||
interpreter = MockInterpreter({'script': []}, None)
|
interpreter = MockInterpreter(TEST_INSTALLER, None)
|
||||||
command, params = interpreter._map_command({'move': 'whatever'})
|
command, params = interpreter._map_command({'move': 'whatever'})
|
||||||
self.assertIn("bound method CommandsMixin.move", str(command))
|
self.assertIn("bound method CommandsMixin.move", str(command))
|
||||||
self.assertEqual(params, "whatever")
|
self.assertEqual(params, "whatever")
|
||||||
|
|
||||||
def test_get_command_doesnt_return_private_methods(self):
|
def test_get_command_doesnt_return_private_methods(self):
|
||||||
""" """
|
""" """
|
||||||
interpreter = MockInterpreter({'script': []}, None)
|
interpreter = MockInterpreter(TEST_INSTALLER, None)
|
||||||
with self.assertRaises(ScriptingError) as ex:
|
with self.assertRaises(ScriptingError) as ex:
|
||||||
command, params = interpreter._map_command(
|
command, params = interpreter._map_command(
|
||||||
{'_substitute': 'foo'}
|
{'_substitute': 'foo'}
|
||||||
|
|
Loading…
Reference in a new issue