mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 14:05:59 -03:30
presume 401 from insights means invalid credential
* Tell the user about the invalid credentials
This commit is contained in:
@@ -158,6 +158,14 @@ class TestHostInsights():
|
||||
(msg, code) = view.get_insights('https://myexample.com/whocares/me/', 'ignore', 'ignore')
|
||||
assert msg['error'] == 'Failed to gather reports and maintenance plans from Insights API at URL https://myexample.com/whocares/me/. Server responded with 500 status code and message mock 500 err msg'
|
||||
|
||||
def test_get_insights_401(self, patch_parent, mocker):
|
||||
view = HostInsights()
|
||||
Response = namedtuple('Response', 'status_code content')
|
||||
mocker.patch.object(view, '_get_insights', return_value=Response(401, ''))
|
||||
|
||||
(msg, code) = view.get_insights('https://myexample.com/whocares/me/', 'ignore', 'ignore')
|
||||
assert msg['error'] == 'Unauthorized access. Please check your Insights Credential username and password.'
|
||||
|
||||
def test_get_insights_malformed_json_content(self, patch_parent, mocker):
|
||||
view = HostInsights()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user