def test_gateway_status(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": "5c8dc6227ec06", "action": "gateway_status", "message": "ok", "data": {"gateway_status": {}}}'

    response = fauxapi.gateway_status()
    assert response['action'] == 'gateway_status'
    assert response['message'] == 'ok'
    assert response['data'] is not None
Пример #2
0
# system_stats
# =============================================================================
print(json.dumps(
    FauxapiLib.system_stats())
)

# interface_stats - NB: the real interface name, not an interface alias such as "WAN" or "LAN"
# =============================================================================
print(json.dumps(
    FauxapiLib.interface_stats('em0'))
)

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

# send_event - filter reload
# =============================================================================
print(json.dumps(
    FauxapiLib.send_event('filter reload'))
)

# send_event - interface all reload
# =============================================================================
print(json.dumps(
    FauxapiLib.send_event('interface all reload'))
)

# rule_get - get all rules
Пример #3
0
# =============================================================================
# print(json.dumps(
#     FauxapiLib.config_restore('/cf/conf/backup/config-1530604754.xml'))
# )

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

# interface_stats - NB: the real interface name, not an interface alias such as "WAN" or "LAN"
# =============================================================================
print(json.dumps(FauxapiLib.interface_stats('em0')))

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

# send_event - filter reload
# =============================================================================
print(json.dumps(FauxapiLib.send_event('filter reload')))

# send_event - interface all reload
# =============================================================================
print(json.dumps(FauxapiLib.send_event('interface all reload')))

# rule_get - get all rules
# =============================================================================
print(json.dumps(FauxapiLib.rule_get()))

# rule_get - get rule number 5
# =============================================================================