mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #2819 from ryanpetrello/fix-busted-tests
mock an HTTP call to fix busted unit tests Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
d9866c35b4
@ -221,8 +221,12 @@ class TestHostInsights():
|
||||
assert resp.status_code == 404
|
||||
|
||||
def test_get_insights_user_agent(self, patch_parent, mocker):
|
||||
resp = HostInsights()._get_insights('https://example.org', 'joe', 'example')
|
||||
assert re.match(r'AWX [^\s]+ \(open\)', resp.request.headers['User-Agent'])
|
||||
with mock.patch.object(requests.Session, 'get') as get:
|
||||
HostInsights()._get_insights('https://example.org', 'joe', 'example')
|
||||
assert get.call_count == 1
|
||||
args, kwargs = get.call_args_list[0]
|
||||
assert args == ('https://example.org',)
|
||||
assert re.match(r'AWX [^\s]+ \(open\)', kwargs['headers']['User-Agent'])
|
||||
|
||||
|
||||
class TestSurveySpecValidation:
|
||||
|
Loading…
Reference in New Issue
Block a user