From 74544079566f34a79eb452fa47af8921c554e3bf Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sun, 24 Nov 2019 14:45:50 +0500 Subject: [PATCH] test_saveSSL --- websiteFunctions/tests.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/websiteFunctions/tests.py b/websiteFunctions/tests.py index 7e286b3f8..e1a4349ce 100755 --- a/websiteFunctions/tests.py +++ b/websiteFunctions/tests.py @@ -401,6 +401,24 @@ phpinfo(); self.assertEqual(exists, 1) + def test_saveSSL(self): + + ## Inserting something in rewrite file + + data_ret = {'virtualHost': 'cyberpanel.xyz', 'key': 'hello world', 'cert': 'hello world'} + + response = self.MakeRequest('websites/saveSSL', data_ret) + + self.assertEqual(response['sslStatus'], 1) + + ## Check again + + certPath = '/etc/letsencrypt/live/cyberpanel.xyz/fullchain.pem' + keyPath = '/etc/letsencrypt/live/cyberpanel.xyz/privkey.pem' + + self.assertGreater(open(certPath, 'r').read().find('hello world'), -1) + self.assertGreater(open(keyPath, 'r').read().find('hello world'), -1) +