mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
test_submitUserCreation
This commit is contained in:
21
api/tests.py
21
api/tests.py
@@ -146,4 +146,25 @@ class TestAPI(TestCase):
|
|||||||
|
|
||||||
self.assertEqual(suspend, 1)
|
self.assertEqual(suspend, 1)
|
||||||
|
|
||||||
|
def test_submitUserCreation(self):
|
||||||
|
|
||||||
|
## Login
|
||||||
|
|
||||||
|
data_ret = {
|
||||||
|
"adminUser": "admin",
|
||||||
|
"adminPass": "1234567",
|
||||||
|
"firstName": "Usman",
|
||||||
|
"lastName": "Nasir",
|
||||||
|
"email": "usman@cyberpersons.com",
|
||||||
|
"userName": "usman",
|
||||||
|
"password": "helloworld123",
|
||||||
|
"websitesLimit": 50,
|
||||||
|
"selectedACL": "user",
|
||||||
|
"securityLevel": "HIGH",
|
||||||
|
}
|
||||||
|
response = self.MakeRequest('submitUserCreation', data_ret)
|
||||||
|
logging.writeToFile(str(response))
|
||||||
|
|
||||||
|
self.assertEqual(response['status'], 1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from s3Backups.s3Backups import S3Backups
|
|||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from userManagment.views import submitUserCreation
|
from userManagment.views import submitUserCreation as suc
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@@ -613,7 +613,7 @@ def submitUserCreation(request):
|
|||||||
|
|
||||||
if hashPassword.check_password(admin.password, adminPass):
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
request.session['userID'] = admin.pk
|
request.session['userID'] = admin.pk
|
||||||
return submitUserCreation(request)
|
return suc(request)
|
||||||
else:
|
else:
|
||||||
data_ret = {"status": 0,
|
data_ret = {"status": 0,
|
||||||
'error_message': "Could not authorize access to API"}
|
'error_message': "Could not authorize access to API"}
|
||||||
|
|||||||
Reference in New Issue
Block a user