Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,18 @@ def test_get_plugins_success(self, client_with_api_key):
response = client_with_api_key.get_plugins()
assert response.is_success()
assert len(response.json()) == 2
assert response.json()[0].name == "GrafanaOpenPlugin"
assert response.json()[0].description == "Grafana open instances"
assert response.json()[1].name == "MongoOpenPlugin"
assert response.json()[1].description == "MongoDB open instances"

def test_get_plugins_unauthorized(self, client):
res_json = {"error": "unauthorized"}
with requests_mock.Mocker() as m:
m.get(f"{client.base_url}/api/plugins", json=res_json, status_code=401)
response = client.get_plugins()
assert response.is_error()
assert response.status_code() == 401


class TestGetSubdomains:
Expand All @@ -225,6 +230,10 @@ def test_get_subdomains_success(self, client):
response = client.get_subdomains("example.com")
assert response.is_success()
assert len(response.json()) == 2
assert response.json()[0].subdomain == "api.example.com"
assert response.json()[0].distinct_ips == 2
assert response.json()[1].subdomain == "www.example.com"
assert response.json()[1].distinct_ips == 1

def test_get_subdomains_empty(self, client):
with requests_mock.Mocker() as m:
Expand Down