File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -237,6 +237,34 @@ def test_create_prefix_users(self):
237237 except (urlerror .HTTPError , OSError , ConnectionResetError , ValueError ) as error :
238238 self .fail (f"Cannot download PDF file: { error } " )
239239
240+ def test_openvpn_config_whitespace_handling (self ):
241+ """Verify openvpn_config_download handles whitespace."""
242+ import os
243+ import subprocess
244+ import tempfile
245+
246+ with tempfile .TemporaryDirectory () as tmpdir :
247+ u_path = os .path .abspath ("images/common/utils.sh" )
248+ script = (
249+ f"source { u_path } \n "
250+ "curl() { true; }\n "
251+ "tar() { touch 'my vpn with spaces.conf'; }\n "
252+ "chmod() { true; }\n "
253+ "UUID='x'; KEY='x'; API='http://x'\n "
254+ "openvpn_config_download\n "
255+ "if [ -f 'openvpn.conf' ]; then echo 'PASS'; fi\n "
256+ )
257+ script_path = os .path .join (tmpdir , "test_mock.sh" )
258+ with open (script_path , "w" ) as sf :
259+ sf .write (script )
260+ res = subprocess .run (
261+ ["bash" , script_path ],
262+ cwd = tmpdir ,
263+ capture_output = True ,
264+ text = True ,
265+ )
266+ self .assertIn ("PASS" , res .stdout )
267+
240268 def test_console_errors (self ):
241269 url_list = [
242270 "/admin/" ,
@@ -492,5 +520,6 @@ def test_containers_down(self):
492520if __name__ == "__main__" :
493521 suite = unittest .TestSuite ()
494522 suite .addTest (TestServices ("test_topology_graph" ))
523+ suite .addTest (TestServices ("test_openvpn_config_whitespace_handling" ))
495524 runner = unittest .TextTestRunner (verbosity = 2 )
496525 runner .run (suite )
You can’t perform that action at this time.
0 commit comments