Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Commit

Permalink
Hotfix/validate command fail (#38)
Browse files Browse the repository at this point in the history
* update validate customer journey

* bumbed up the version
  • Loading branch information
mwaaas authored Jan 15, 2017
1 parent 18c3cc2 commit 2a0ad77
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
6 changes: 5 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Ussd Airflow Changelog
================

Version 0.0.1.5
------------
----------------
Released on 15th Jan 2017

Feature
Expand All @@ -11,3 +11,7 @@ Feature
Enhancement
- increased ussd maximum text to 500

Version 0.0.1.6
----------------
Enhancement
- validate_ussd_journey command to fail if customer journey fails validation
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '0.0.1.5'
__version__ = '0.0.1.6'

setup(
name='ussd_airflow',
Expand Down
4 changes: 3 additions & 1 deletion ussd/management/commands/validate_ussd_journey.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class Command(BaseCommand):
help = 'Closes the specified poll for voting'
help = 'Validate ussd customer journey'

def add_arguments(self, parser):
parser.add_argument('ussd_configs', nargs='+', type=str)
Expand All @@ -31,5 +31,7 @@ def handle(self, *args, **options):
valid=is_valid,
error_message=error_ussd_config_message
)
if not is_valid:
raise CommandError(json.dumps(error_message))

self.stdout.write(json.dumps(error_message))
15 changes: 8 additions & 7 deletions ussd/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ class ValidateCustomerJourneyConfig(TestCase):

def test_command_output(self):
out = StringIO()
file_name = "{0}/invalid_quit_screen_conf.yml".format(path)
file_name = "{0}/valid_quit_screen_conf.yml".format(path)
call_command('validate_ussd_journey', file_name, stdout=out)
expected_output = {
file_name: dict(
valid=False,
error_message=dict(
example_of_quit_screen=dict(
text=['This field is required.']
)
)
valid=True,
error_message=dict()
)
}
self.assertDictEqual(expected_output, json.loads(out.getvalue()))

def testing_invalid_ussd_journey(self):
out = StringIO()
file_name = "{0}/invalid_quit_screen_conf.yml".format(path)
self.assertRaises(CommandError, call_command, 'validate_ussd_journey', file_name, stdout=out)

def test_called_with_multiple_files(self):
out = StringIO()
file_1 = "{0}/valid_quit_screen_conf.yml".format(path)
Expand Down

0 comments on commit 2a0ad77

Please sign in to comment.