File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -796,4 +796,8 @@ def clean_name(self):
796
796
raise forms .ValidationError (
797
797
_ ('There is already a variable with this name for this project' ),
798
798
)
799
+ elif ' ' in name :
800
+ raise forms .ValidationError (
801
+ _ ("Variable name can't contain spaces" ),
802
+ )
799
803
return name
Original file line number Diff line number Diff line change @@ -487,6 +487,17 @@ def setUp(self):
487
487
self .project = get (Project )
488
488
489
489
def test_use_invalid_names (self ):
490
+ data = {
491
+ 'name' : 'VARIABLE WITH SPACES' ,
492
+ 'value' : 'string here' ,
493
+ }
494
+ form = EnvironmentVariableForm (data , project = self .project )
495
+ self .assertFalse (form .is_valid ())
496
+ self .assertIn (
497
+ "Variable name can't contain spaces" ,
498
+ form .errors ['name' ],
499
+ )
500
+
490
501
data = {
491
502
'name' : 'READTHEDOCS__INVALID' ,
492
503
'value' : 'string here' ,
@@ -497,6 +508,7 @@ def test_use_invalid_names(self):
497
508
"Variable name can't start with READTHEDOCS" ,
498
509
form .errors ['name' ],
499
510
)
511
+
500
512
data = {
501
513
'name' : '__INVALID' ,
502
514
'value' : 'string here' ,
You can’t perform that action at this time.
0 commit comments