def test_rule_get(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": "5c8dc731b54e2", "action": "rule_get", "message": "ok", "data": {"rules": []}}'

    response = fauxapi.rule_get()
    assert response['action'] == 'rule_get'
    assert response['message'] == 'ok'
    assert response['data'] is not None
Esempio n. 2
0
# 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
# =============================================================================
print(json.dumps(
    FauxapiLib.rule_get(5))
)

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

# # system reboot
Esempio n. 3
0
# 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
# =============================================================================
print(json.dumps(FauxapiLib.rule_get(5)))

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

# # system reboot
# =============================================================================
# print(json.dumps(
#     FauxapiLib.system_reboot())
# )