mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
53 lines
1.6 KiB
Python
Executable File
53 lines
1.6 KiB
Python
Executable File
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.test import TestCase
|
|
import json
|
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
|
import requests
|
|
import time
|
|
from plogical.processUtilities import ProcessUtilities
|
|
import urllib3
|
|
urllib3.disable_warnings()
|
|
# Create your tests here.
|
|
|
|
|
|
class TestPackages(TestCase):
|
|
httpClient = requests.Session()
|
|
|
|
def MakeRequest(self, endPoint, data):
|
|
json_data = json.dumps(data)
|
|
path = 'https://cyberpanel.xyz:8090/%s' % (endPoint)
|
|
result = TestPackages.httpClient.post(path, data=json_data, verify=False)
|
|
return json.loads(result.text)
|
|
|
|
def MakeRequestRaw(self, path):
|
|
result = requests.get(path)
|
|
return str(result.text)
|
|
|
|
def setUp(self):
|
|
## Verify login
|
|
|
|
data_ret = {'username': 'admin', 'password': '1234567'}
|
|
response = self.MakeRequest('verifyLogin', data_ret)
|
|
self.assertEqual(response['loginStatus'], 1)
|
|
|
|
def test_submitPackage(self):
|
|
|
|
## Login
|
|
|
|
data_ret = {'domainName': 'hello.cyberpanel.xyz', 'adminEmail': 'usman@cyberpersons.com' , 'phpSelection': 'PHP 7.1',
|
|
'package': 'Default', 'websiteOwner': 'admin', 'ssl': 0, 'dkimCheck': 0, 'openBasedir': 0}
|
|
response = self.MakeRequest('packages/submitPackage', data_ret)
|
|
|
|
time.sleep(10)
|
|
|
|
self.assertEqual(response['status'], 1)
|
|
|
|
exists = 0
|
|
|
|
if self.MakeRequestRaw('http://hello.cyberpanel.xyz').find('CyberPanel') > -1:
|
|
exists = 1
|
|
|
|
self.assertEqual(exists, 1)
|