Skip to content

Commit

Permalink
Fix error when channel file or folder does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Cabezas committed Jun 15, 2019
1 parent 307d914 commit 5aaacd0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ldap_expire_notify/channel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@


def parse(path):
data = {'channels': {}}
if os.path.isfile(path):
data = parse_file(path)
elif os.path.isdir(path):
data = {'channels': {}}
for root, _, files in os.walk(path):
for f in files:
abs_path = os.path.join(root, f)
Expand Down
2 changes: 1 addition & 1 deletion ldap_expire_notify/meta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
author = 'Victor Cabezas'
author_email = 'vcabezas@tuenti.com'
version = '0.1.0'
version = '0.1.1'
description = 'Notify users of OpenLDAP about the expiration of their password'
3 changes: 3 additions & 0 deletions tests/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def test_parse_directory_ko():
with pytest.raises(ValueError):
r = channel.parse('/tmp/')

with pytest.raises(ValueError):
r = channel.parse('/non-existent-chan/')


def test_parse_directory():
r = channel.parse('channels/')
Expand Down

0 comments on commit 5aaacd0

Please sign in to comment.