1
0
mirror of https://github.com/gryf/slack-backup.git synced 2025-12-17 19:40:21 +01:00

1 Commits

Author SHA1 Message Date
3f95986981 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.
2016-11-28 18:14:47 +01:00
3 changed files with 13 additions and 14 deletions

View File

@@ -10,7 +10,7 @@ except ImportError:
setup(name="slack-backup", setup(name="slack-backup",
packages=["slack_backup"], packages=["slack_backup"],
version="0.4.1", version="0.4.2",
description="Make copy of slack converstaions", description="Make copy of slack converstaions",
author="Roman Dobosz", author="Roman Dobosz",
author_email="gryf73@gmail.com", author_email="gryf73@gmail.com",

View File

@@ -83,19 +83,25 @@ class Config(object):
val = self.cp.get(section, option, fallback='[]') val = self.cp.get(section, option, fallback='[]')
val = json.loads(val) val = json.loads(val)
else: else:
val = self.cp.get(section, option, fallback='') val = self.cp.get(section, option, fallback=None)
self._options[option] = val self._options[option] = val
def update_args(self, args): 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 # special case, re-set information for verbose/quiet options
if args.verbose is not None and self._options['quiet'] is not None: if 'verbose' in args and args.verbose is not None:
self._options['quiet'] = 0
self._options['verbose'] = args.verbose self._options['verbose'] = args.verbose
if args.quiet is not None and self._options['verbose'] is not None: if self._options['quiet'] is not None:
self._options['verbose'] = 0 self._options['quiet'] = 0
if 'quiet' in args and args.quiet is not None:
self._options['quiet'] = args.quiet self._options['quiet'] = args.quiet
if self._options['verbose'] is not None:
self._options['verbose'] = 0
for sec_id in (args.parser, 'common'): for sec_id in (args.parser, 'common'):
for option in self.sections[sec_id]: for option in self.sections[sec_id]:

View File

@@ -51,13 +51,6 @@ class TestConfig(unittest.TestCase):
args.config = None args.config = None
args.parser = 'fetch' args.parser = 'fetch'
args.verbose = 2 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 = config.Config()
conf.update(args) conf.update(args)
@@ -66,7 +59,7 @@ class TestConfig(unittest.TestCase):
'verbose': 2, 'verbose': 2,
'quiet': 0, 'quiet': 0,
'channels': [], 'channels': [],
'database': '', 'database': None,
'user': None, 'user': None,
'password': None, 'password': None,
'team': None, 'team': None,