Skip to content

Commit

Permalink
Improve config data error message
Browse files Browse the repository at this point in the history
  • Loading branch information
cruizer committed Feb 6, 2020
1 parent c84f2f0 commit c752a02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dupcomposer/backup_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, group_data, group_name):

for i in self.mandatory_datakeys:
if i not in self.group_data:
raise KeyError('Invalid backup group configuration data')
raise KeyError('Invalid group configuration data, key "%s" is missing.' % i)

self.encryption = BackupEncryption(group_data['encryption'], self)
self.provider = BackupProvider.factory(group_data['backup_provider'], self)
Expand Down
7 changes: 4 additions & 3 deletions tests/test_backup_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ def test_group_data(self):
'scp://[email protected]/')

def test_invalid_group_data(self):
self.assertRaises(KeyError,
BackupGroup,
{'foo': 'bar'}, 'foo')
self.assertRaisesRegex(KeyError,
'Invalid group configuration data, key "encryption" is missing.',
BackupGroup,
{'foo': 'bar'}, 'foo')

def test_volume_cmd(self):
self.assertEqual(self.backup_groups['my_local_backups']._get_volume_cmd(),
Expand Down

0 comments on commit c752a02

Please sign in to comment.