Fix tests

This commit is contained in:
Mathieu Comandon 2013-07-11 14:53:12 +02:00
parent fe660706b5
commit e98b74d946
2 changed files with 15 additions and 4 deletions

View file

@ -3,6 +3,15 @@ from unittest import TestCase
from lutris.installer import ScriptInterpreter, ScriptingError
class MockInterpreter(ScriptInterpreter):
""" a script interpreter mock """
def _fetch_script(self, name):
return {'runner': 'linux'}
def is_valid(self):
return True
class TestScriptInterpreter(TestCase):
def test_script_with_correct_values_is_valid(self):
script_data = """
@ -28,14 +37,16 @@ class TestScriptInterpreter(TestCase):
interpreter._get_move_paths({})
def test_get_command_returns_a_method(self):
command, params = ScriptInterpreter._map_command({'move': 'whatever'})
self.assertIn("bound method ScriptInterpreter.move", str(command))
interpreter = MockInterpreter('test', None)
command, params = interpreter._map_command({'move': 'whatever'})
self.assertIn("bound method MockInterpreter.move", str(command))
self.assertEqual(params, "whatever")
def test_get_command_doesnt_return_private_methods(self):
""" """
interpreter = MockInterpreter('test', None)
with self.assertRaises(ScriptingError) as ex:
command, params = ScriptInterpreter._map_command(
command, params = interpreter._map_command(
{'_substitute': 'foo'}
)
self.assertEqual(ex.exception.message,

View file

@ -24,7 +24,7 @@ class TestPersonnalGameArchive(unittest.TestCase):
self.assertTrue("LutrisTest" in game_names)
def test_delete_game(self):
pga.delete_game("LutrisTest")
pga.delete_game("lutristest")
game_list = pga.get_games()
self.assertEqual(len(game_list), 0)
pga.add_game(name="LutrisTest", runner="Linux")