-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metrics Collection: Added GALAXY_API_PATH_PREFIX to API call
Jira AA-1892 No-Issue Signed-off-by: Martin Slemr <[email protected]>
- Loading branch information
1 parent
b10dd99
commit 2255a1e
Showing
2 changed files
with
25 additions
and
2 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
21 changes: 21 additions & 0 deletions
21
galaxy_ng/tests/unit/app/management/commands/analytics/automation_analytics/test_data.py
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,21 @@ | ||
import galaxy_ng.app.metrics_collection.common_data | ||
from django.test import TestCase, override_settings | ||
from unittest.mock import MagicMock, patch | ||
|
||
|
||
class TestAutomationAnalyticsData(TestCase): | ||
@override_settings(ANSIBLE_API_HOSTNAME='https://example.com') | ||
@override_settings(GALAXY_API_PATH_PREFIX='/api-test/xxx') | ||
@patch('galaxy_ng.app.metrics_collection.common_data.requests.request') | ||
def test_api_status_request(self, mock_request): | ||
mock_response = MagicMock(name="mock_response") | ||
mock_response.status_code = 200 | ||
mock_request.return_value = mock_response | ||
|
||
json_response = MagicMock(name="json") | ||
mock_response.json = json_response | ||
|
||
galaxy_ng.app.metrics_collection.common_data.api_status() | ||
|
||
mock_request.assert_called_with("GET", 'https://example.com/api-test/xxx/pulp/api/v3/status/') | ||
json_response.assert_called_once() |