Skip to content

Commit

Permalink
[tests] test interfaces_json
Browse files Browse the repository at this point in the history
Refs #641
  • Loading branch information
lukasjuhrich committed Jun 29, 2023
1 parent 039063f commit ca657a6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/frontend/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ def interface(module_session, host) -> Interface:
pytestmark = pytest.mark.usefixtures("admin_logged_in")


class TestInterfacesJson:
def test_interfaces_nonexistent_host(self, client):
client.assert_url_response_code(
url_for("host.host_interfaces_json", host_id=999), code=404
)

def test_interfaces_json(self, client, interface):
resp = client.assert_url_ok(
url_for("host.host_interfaces_json", host_id=interface.host.id)
)

assert "items" in resp.json
items = resp.json["items"]
assert len(items) == 1
[item] = items
assert item["id"] == interface.id
assert len(item["actions"]) == 2
assert item["ips"] != ""


@pytest.mark.usefixtures("session")
class TestInterfaceDelete:
def test_delete_nonexistent_interface(self, client):
Expand Down

0 comments on commit ca657a6

Please sign in to comment.