add a user agent for requests to Insights

This commit is contained in:
Ryan Petrello
2018-11-16 15:19:31 -05:00
parent 6a0e11a233
commit 661cc896a9
3 changed files with 17 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
import re
import mock
import pytest
import requests
@@ -218,6 +220,10 @@ class TestHostInsights():
assert resp.data['error'] == 'The Insights Credential for "inventory_name_here" was not found.'
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'])
class TestSurveySpecValidation: