Ejemplo n.º 1
0
def test_delete_results_plugin(client):
    """ Test delete all results for a specific plugin for a given daemon. """
    response = client.post("/trident/connect", json=tired_panda)
    assert response.status_code == 201

    daemon = response.get_json()["daemon"]
    response = client.post("/result/{}/find-file/0".format(daemon),
                           json=find_file_result)
    assert response.status_code == 201

    response = client.post("/result/{}/find-file/1".format(daemon),
                           json=improved_find_file_result)
    assert response.status_code == 201

    response = client.post("/result/{}/scan-hosts-file/0".format(daemon),
                           json=improved_find_file_result)
    assert response.status_code == 201

    response = client.delete("/result/{}/find-file".format(daemon))
    assert response.status_code == 202

    response = client.get("/result/{}/find-file".format(daemon))
    assert response.status_code == 404

    response = client.get("/result/{}/scan-hosts-file".format(daemon))
    assert response.status_code == 200
Ejemplo n.º 2
0
def test_remove_daemon(client):
    """ Test remove a Trident daemon from the dashboard. """
    response = client.post("/trident/connect", json=tired_panda)
    assert response.status_code == 201
    daemon = response.get_json()["daemon"]

    response = client.get("/trident/{}".format(daemon))
    assert response.status_code == 200

    response = client.delete("/trident/remove/{}".format(daemon))
    assert response.status_code == 202

    response = client.get("/trident/{}".format(daemon))
    assert response.status_code == 404
Ejemplo n.º 3
0
def test_delete_results_non_existant_daemon(client):
    """ Test delete all results for a given non-existant daemon. """
    response = client.post("/trident/connect", json=tired_panda)
    assert response.status_code == 201

    daemon = response.get_json()["daemon"]
    response = client.post("/result/{}/find-file/0".format(daemon),
                           json=find_file_result)
    assert response.status_code == 201

    response = client.post("/result/{}/find-file/1".format(daemon),
                           json=improved_find_file_result)
    assert response.status_code == 201

    response = client.delete("/result/{}".format(daemon + "-test"))
    assert response.status_code == 202
Ejemplo n.º 4
0
def test_disconnect_daemon(client):
    """ Test disconnect a daemon from the dashboard. """
    response = client.post("/trident/connect", json=tired_panda)
    assert response.status_code == 201

    daemon_name = response.get_json()["daemon"]
    response, = client.get("/trident/connected").get_json()
    assert response["daemon"] == daemon_name

    response = client.delete("/trident/disconnect/{}".format(daemon_name))
    assert response.status_code == 202

    response = client.get("/trident/connected")
    assert response.status_code == 404

    response = client.get("/trident/{}".format(daemon_name))
    assert response.status_code == 200
Ejemplo n.º 5
0
def test_remove_non_connected_daemon(client):
    """ Test remove a daemon that is not connected to the dashboard. """
    response = client.delete("/trident/remove/tired-panda")
    assert response.status_code == 202
Ejemplo n.º 6
0
def test_disconnect_non_connected_daemon(client):
    """ Test disconnect a daemon from the dashboard. """
    response = client.delete("/trident/disconnect/tired-panda")
    assert response.status_code == 202