def test_system_info(mock_requests_get):

    fauxapi = PfsenseFauxapi(host=None, apikey=None, apisecret=None)
    mock_requests_get.return_value.status_code = 200
    mock_requests_get.return_value.text = '{"callid": "5ed39b838c8f6", "action": "system_info", "message": "ok", "data": {"info": "foobar"}}'

    response = fauxapi.system_info()
    assert response['action'] == 'system_info'
    assert response['message'] == 'ok'
    assert response['data'] is not None
Exemplo n.º 2
0
        'function': 'get_services',
    }
)))

print(json.dumps(
    FauxapiLib.function_call({
        'function': 'get_service_status',
        'args': ['ntpd']
    }
)))

print(json.dumps(
    FauxapiLib.function_call({
        'function': 'is_service_enabled',
        'args': ['ntpd']
    }
)))

print(json.dumps(
    FauxapiLib.function_call({
        'function': 'is_service_running',
        'args': ['ntpd']
    }
)))

# system_info
# =============================================================================
print(json.dumps(
    FauxapiLib.system_info())
)