-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2305 from mitre/bleepbop/VIRTS-2881/health-v2-api…
…-pytest [VIRTS-2881] Health API v2 Pytests
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
import app | ||
|
||
from http import HTTPStatus | ||
|
||
|
||
@pytest.fixture | ||
def expected_caldera_info(): | ||
return { | ||
'application': 'CALDERA', | ||
'plugins': [ | ||
{ | ||
'address': '/plugin/sandcat/gui', | ||
'description': 'A custom multi-platform RAT', | ||
'enabled': True, | ||
'name': 'sandcat' | ||
}, | ||
{ | ||
'address': 'plugin/ssl/gui', | ||
'description': 'Run an SSL proxy in front of the server', | ||
'enabled': False, | ||
'name': 'ssl' | ||
} | ||
], | ||
'version': app.get_version() | ||
} | ||
|
||
|
||
class TestHealthApi: | ||
async def test_get_health(self, api_v2_client, api_cookies, expected_caldera_info): | ||
resp = await api_v2_client.get('/api/v2/health', cookies=api_cookies) | ||
assert resp.status == HTTPStatus.OK | ||
output_info = await resp.json() | ||
assert output_info == expected_caldera_info | ||
|
||
async def test_unauthorized_get_health(self, api_v2_client, expected_caldera_info): | ||
resp = await api_v2_client.get('/api/v2/health') | ||
assert resp.status == HTTPStatus.OK | ||
output_info = await resp.json() | ||
assert output_info == expected_caldera_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters