mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 15:08:40 +00:00
Revert 5619
Fix find_json_objects when there is a newline at the end of the string Add test for find_json_objects
This commit is contained in:
parent
5f561dabda
commit
ac9be780cf
2 changed files with 19 additions and 5 deletions
|
@ -72,7 +72,6 @@ import shutil
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.configmanager
|
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
|
||||||
json = deluge.common.json
|
json = deluge.common.json
|
||||||
|
@ -153,7 +152,7 @@ class Config(object):
|
||||||
if config_dir:
|
if config_dir:
|
||||||
self.__config_file = os.path.join(config_dir, filename)
|
self.__config_file = os.path.join(config_dir, filename)
|
||||||
else:
|
else:
|
||||||
self.__config_file = deluge.configmanager.get_config_dir(filename)
|
self.__config_file = deluge.common.get_default_config_dir(filename)
|
||||||
|
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
|
|
|
@ -97,3 +97,18 @@ class ConfigTestCase(unittest.TestCase):
|
||||||
d = deferLater(reactor, 7, check_config, config)
|
d = deferLater(reactor, 7, check_config, config)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def test_find_json_objects(self):
|
||||||
|
s = """{
|
||||||
|
"file": 1,
|
||||||
|
"format": 1
|
||||||
|
}{
|
||||||
|
"ssl": true,
|
||||||
|
"enabled": false,
|
||||||
|
"port": 8115
|
||||||
|
}\n"""
|
||||||
|
|
||||||
|
from deluge.config import find_json_objects
|
||||||
|
|
||||||
|
objects = find_json_objects(s)
|
||||||
|
self.assertEquals(len(objects), 2)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue