1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

get accepts data param, use it

This commit is contained in:
Chris Meyers 2016-03-01 10:08:08 -05:00
parent 5340af2335
commit b5d8aa52c9
2 changed files with 4 additions and 18 deletions

View File

@ -16,19 +16,12 @@ from django.utils import timezone
def mock_feature_enabled(feature, bypass_database=None):
return True
def build_url(*args, **kwargs):
get = kwargs.pop('get', {})
url = reverse(*args, **kwargs)
if get:
url += '?' + urllib.urlencode(get)
return url
def setup_common(hosts, fact_scans, get, user, epoch=timezone.now(), get_params={}, host_count=1):
hosts = hosts(host_count=host_count)
fact_scans(fact_scans=3, timestamp_epoch=epoch)
url = build_url('api:host_fact_versions_list', args=(hosts[0].pk,), get=get_params)
response = get(url, user('admin', True))
url = reverse('api:host_fact_versions_list', args=(hosts[0].pk,))
response = get(url, user('admin', True), data=get_params)
return (hosts[0], response)

View File

@ -10,13 +10,6 @@ from django.utils import timezone
def mock_feature_enabled(feature, bypass_database=None):
return True
def build_url(*args, **kwargs):
get = kwargs.pop('get', {})
url = reverse(*args, **kwargs)
if get:
url += '?' + urllib.urlencode(get)
return url
# TODO: Consider making the fact_scan() fixture a Class, instead of a function, and move this method into it
def find_fact(facts, host_id, module_name, timestamp):
for f in facts:
@ -28,8 +21,8 @@ def setup_common(hosts, fact_scans, get, user, epoch=timezone.now(), module_name
hosts = hosts(host_count=1)
facts = fact_scans(fact_scans=1, timestamp_epoch=epoch)
url = build_url('api:host_fact_compare_view', args=(hosts[0].pk,), get=get_params)
response = get(url, user('admin', True), params=get_params)
url = reverse('api:host_fact_compare_view', args=(hosts[0].pk,))
response = get(url, user('admin', True), data=get_params)
fact_known = find_fact(facts, hosts[0].id, module_name, epoch)
return (fact_known, response)