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

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaaas committed Apr 19, 2017
2 parents e9ef8c9 + 0e07605 commit 21580c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ussd/management/commands/validate_ussd_journey.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import staticconf
from django.core.management.base import BaseCommand, CommandError
from ussd.core import UssdView
from ussd.core import UssdView, load_yaml
import os
import json

Expand All @@ -16,13 +16,12 @@ def handle(self, *args, **options):
for ussd_config in options["ussd_configs"]:
if not os.path.isfile(ussd_config):
raise CommandError("This file path {} does not exist".format(ussd_config))
staticconf.YamlConfiguration(
ussd_config,
namespace="validation",
flatten=False)
namespace = 'validation'
load_yaml(ussd_config, namespace)


ussd_screens = staticconf.config. \
get_namespace("validation"). \
get_namespace(namespace). \
get_config_values()

is_valid, error_ussd_config_message = UssdView.validate_ussd_journey(
Expand Down
6 changes: 6 additions & 0 deletions ussd/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def test_called_with_multiple_files(self):
file_1 = "{0}/valid_quit_screen_conf.yml".format(path)
file_2 = "{0}/valid_http_screen_conf.yml".format(path)
file_3 = "{0}/valid_input_screen_conf.yml".format(path)
file_4 = "{0}/sample_using_inheritance.yml".format(path)
call_command(
"validate_ussd_journey",
file_1,
file_2,
file_3,
file_4,
stdout=out)

expected_output = {
Expand All @@ -51,6 +53,10 @@ def test_called_with_multiple_files(self):
file_3: dict(
valid=True,
error_message={}
),
file_4: dict(
valid=True,
error_message={}
)
}

Expand Down

0 comments on commit 21580c7

Please sign in to comment.