-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BB-212] Project name validation (#215)
* project.yaml validations on "project create" * adapt test project name * lower case letters, numbers and hypens, 25 chars max * clarify error * adapting integration test * Update leverage/modules/project.py Co-authored-by: Angelo Fenoglio <[email protected]> * Update leverage/modules/project.py Co-authored-by: Angelo Fenoglio <[email protected]> * Update leverage/modules/project.py --------- Co-authored-by: Angelo Fenoglio <[email protected]>
- Loading branch information
1 parent
5cbbb4f
commit 48add55
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from leverage._utils import ExitError | ||
from leverage.modules.project import validate_config | ||
|
||
|
||
def test_validate_config_happy_path(): | ||
assert validate_config({"project_name": "fine"}) | ||
assert validate_config({"project_name": "fine123"}) | ||
assert validate_config({"project_name": "123fine"}) | ||
assert validate_config({"project_name": "hyphens-are-allowed"}) | ||
|
||
|
||
def test_validate_config_errors(muted_click_context): | ||
with pytest.raises(ExitError, match="Project name is not valid"): | ||
validate_config({"project_name": "with spaces"}) | ||
|
||
with pytest.raises(ExitError, match="Project name is not valid"): | ||
validate_config({"project_name": "underscores_not_allowed"}) | ||
|
||
with pytest.raises(ExitError, match="Project name is not valid"): | ||
validate_config({"project_name": "not-alph@-characters!"}) | ||
|
||
with pytest.raises(ExitError, match="Project name is not valid"): | ||
validate_config({"project_name": "loooooooooooooooooooooooooooooooooooooooooooooooooooooong"}) |