From c838f7da1862c5d97e3cdc3530c52b34a9d50df4 Mon Sep 17 00:00:00 2001 From: Gabor Nagy Date: Tue, 21 Oct 2014 13:32:54 +0200 Subject: [PATCH] Convert project_name to lowercase Signed-off-by: Gabor Nagy --- fig/cli/command.py | 2 +- tests/unit/cli_test.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fig/cli/command.py b/fig/cli/command.py index 743c96e9..6cc7acad 100644 --- a/fig/cli/command.py +++ b/fig/cli/command.py @@ -81,7 +81,7 @@ class Command(DocoptCommand): def get_project_name(self, config_path, project_name=None): def normalize_name(name): - return re.sub(r'[^a-zA-Z0-9]', '', name) + return re.sub(r'[^a-z0-9]', '', name.lower()) project_name = project_name or os.environ.get('FIG_PROJECT_NAME') if project_name is not None: diff --git a/tests/unit/cli_test.py b/tests/unit/cli_test.py index c9151165..bc3daa11 100644 --- a/tests/unit/cli_test.py +++ b/tests/unit/cli_test.py @@ -29,6 +29,12 @@ class CLITestCase(unittest.TestCase): project_name = command.get_project_name(command.get_config_path()) self.assertEquals('simplefigfile', project_name) + def test_project_name_with_explicit_uppercase_base_dir(self): + command = TopLevelCommand() + command.base_dir = 'tests/fixtures/Simple-figfile' + project_name = command.get_project_name(command.get_config_path()) + self.assertEquals('simplefigfile', project_name) + def test_project_name_with_explicit_project_name(self): command = TopLevelCommand() name = 'explicit-project-name'