mirror of
https://github.com/lutris/lutris
synced 2024-09-05 23:46:21 +00:00
Fix some unittests
This commit is contained in:
parent
796e62ae3f
commit
b60dce5612
|
@ -273,7 +273,7 @@ class LutrisConfig(object):
|
|||
"""Return a dict of options' default value."""
|
||||
options_dict = self.options_as_dict(options_type)
|
||||
defaults = {}
|
||||
for option, params in options_dict.iteritems():
|
||||
for option, params in options_dict.items():
|
||||
if 'default' in params:
|
||||
defaults[option] = params['default']
|
||||
return defaults
|
||||
|
|
|
@ -8,9 +8,9 @@ def slugify(value):
|
|||
Normalizes string, converts to lowercase, removes non-alpha characters,
|
||||
and converts spaces to hyphens.
|
||||
"""
|
||||
value = value.decode('UTF-8')
|
||||
value = str(value)
|
||||
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
|
||||
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
|
||||
value = str(re.sub('[^\w\s-]', '', value)).strip().lower()
|
||||
return re.sub('[-\s]+', '-', value)
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class TestPersonnalGameArchive(DatabaseTester):
|
|||
pga.add_game(name="installed_game", runner="Linux", installed=1)
|
||||
pga.add_game(name="bang", runner="Linux", installed=0)
|
||||
game_list = pga.get_games(filter_installed=True)
|
||||
print game_list
|
||||
print(game_list)
|
||||
self.assertEqual(len(game_list), 1)
|
||||
self.assertEqual(game_list[0]['name'], 'installed_game')
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logging
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from lutris.config import LutrisConfig
|
||||
from lutris import runners
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from collections import OrderedDict
|
||||
from unittest import TestCase
|
||||
from lutris.util import system
|
||||
from lutris.util import steam
|
||||
|
@ -34,16 +35,16 @@ class TestFileUtils(TestCase):
|
|||
|
||||
class TestSteamUtils(TestCase):
|
||||
def test_dict_to_vdf(self):
|
||||
dict_data = {
|
||||
'AppState': {
|
||||
'appID': '13240',
|
||||
'StateFlags': '4',
|
||||
'UserConfig': {
|
||||
"name": "Unreal Tournament",
|
||||
"gameid": "13240"
|
||||
}
|
||||
}
|
||||
}
|
||||
appstate = OrderedDict()
|
||||
userconfig = OrderedDict()
|
||||
userconfig['gameid'] = "13240"
|
||||
userconfig['name'] = "Unreal Tournament"
|
||||
appstate['UserConfig'] = userconfig
|
||||
appstate['StateFlags'] = '4'
|
||||
appstate['appID'] = '13240'
|
||||
dict_data = OrderedDict()
|
||||
dict_data['AppState'] = appstate
|
||||
|
||||
expected_vdf = """"AppState"
|
||||
{
|
||||
\t"UserConfig"
|
||||
|
|
Loading…
Reference in a new issue