File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 939939 "type" : "string" ,
940940 "description" : "filesystem path" ,
941941 "propertyOrder" : 1 ,
942+ "minLength" : 2 ,
942943 },
943944 "mode" : {
944945 "type" : "string" ,
Original file line number Diff line number Diff line change 33from copy import deepcopy
44
55from netjsonconfig import OpenVpn
6- from netjsonconfig .exceptions import ParseError
6+ from netjsonconfig .exceptions import ParseError , ValidationError
77
88
99class TestParser (unittest .TestCase ):
@@ -159,3 +159,10 @@ def test_parse_tar_file(self):
159159 OpenVpn (native = open ('/tmp/test.tar.gz' ))
160160 os .remove ('/tmp/test.tar.gz' )
161161 self .assertDictEqual (o .config , self ._multiple_vpn )
162+
163+ def test_file_path_min_length (self ):
164+ conf = deepcopy (self ._multiple_vpn )
165+ conf .update ({"files" : [{"path" : "." , "mode" : "0644" , "contents" : "testing!" }]})
166+ with self .assertRaises (ValidationError ) as err :
167+ OpenVpn (conf ).generate ()
168+ self .assertEqual ("'.' is too short" , err .exception .message )
You can’t perform that action at this time.
0 commit comments