| Server IP : 199.250.200.62 / Your IP : 216.73.217.89 Web Server : Apache System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : jasonp18 ( 1000) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/lib/imh-dnskeyapi/tests/ |
Upload File : |
"""Tests the WHM plugin by performing a request to it"""
import requests
import urllib3
# pylint:disable=unused-argument
def test_acl(access_hash):
"""Tests that the authorized_ips setting works by making a request from
127.0.0.1 without allowing it"""
req = _request(access_hash)
assert req.status_code == 200
data = req.json()
# status 2 comes from sanity_check() failing
assert data['status'] == 2
def test_mising_args(access_hash, allow_local):
"""Test handling for when a required argument is missing"""
req = _request(access_hash)
assert req.status_code == 200
data = req.json()
assert data['status'] == 4
assert data['message'] == 'You must specify user, pp_user, and key'
def _request(access_hash, **data):
urllib3.disable_warnings()
return requests.post(
'https://127.0.0.1:2087/cgi/imhapi/set-dns-key.cgi',
headers={'Authorization': f'WHM root:{access_hash}'},
data=data,
verify=False,
timeout=10.0,
)