mirror of
https://github.com/gryf/slack-backup.git
synced 2025-12-17 11:30:25 +01:00
Fix the tests.
For some reason, database key was treated differently in configparser object in python 3.4.2. In Python 3.4.5 everything is fine. Fixed the defaults to make sure all string options are treated equally.
This commit is contained in:
2
setup.py
2
setup.py
@@ -10,7 +10,7 @@ except ImportError:
|
||||
|
||||
setup(name="slack-backup",
|
||||
packages=["slack_backup"],
|
||||
version="0.4.1",
|
||||
version="0.4.2",
|
||||
description="Make copy of slack converstaions",
|
||||
author="Roman Dobosz",
|
||||
author_email="gryf73@gmail.com",
|
||||
|
||||
@@ -83,19 +83,25 @@ class Config(object):
|
||||
val = self.cp.get(section, option, fallback='[]')
|
||||
val = json.loads(val)
|
||||
else:
|
||||
val = self.cp.get(section, option, fallback='')
|
||||
val = self.cp.get(section, option, fallback=None)
|
||||
|
||||
self._options[option] = val
|
||||
|
||||
def update_args(self, args):
|
||||
if 'parser' not in args:
|
||||
# it doesn't make sense to update args, since no action was
|
||||
# choosen
|
||||
return
|
||||
|
||||
# special case, re-set information for verbose/quiet options
|
||||
if args.verbose is not None and self._options['quiet'] is not None:
|
||||
self._options['quiet'] = 0
|
||||
if 'verbose' in args and args.verbose is not None:
|
||||
self._options['verbose'] = args.verbose
|
||||
if args.quiet is not None and self._options['verbose'] is not None:
|
||||
self._options['verbose'] = 0
|
||||
if self._options['quiet'] is not None:
|
||||
self._options['quiet'] = 0
|
||||
if 'quiet' in args and args.quiet is not None:
|
||||
self._options['quiet'] = args.quiet
|
||||
if self._options['verbose'] is not None:
|
||||
self._options['verbose'] = 0
|
||||
|
||||
for sec_id in (args.parser, 'common'):
|
||||
for option in self.sections[sec_id]:
|
||||
|
||||
@@ -51,13 +51,6 @@ class TestConfig(unittest.TestCase):
|
||||
args.config = None
|
||||
args.parser = 'fetch'
|
||||
args.verbose = 2
|
||||
args.quiet = None
|
||||
args.channels = None
|
||||
args.database = None
|
||||
args.user = None
|
||||
args.password = None
|
||||
args.team = None
|
||||
args.token = None
|
||||
|
||||
conf = config.Config()
|
||||
conf.update(args)
|
||||
@@ -66,7 +59,7 @@ class TestConfig(unittest.TestCase):
|
||||
'verbose': 2,
|
||||
'quiet': 0,
|
||||
'channels': [],
|
||||
'database': '',
|
||||
'database': None,
|
||||
'user': None,
|
||||
'password': None,
|
||||
'team': None,
|
||||
|
||||
Reference in New Issue
Block a user