From b5d8aa52c924addfde9715162c21d83604144e50 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Tue, 1 Mar 2016 10:08:08 -0500 Subject: [PATCH] get accepts data param, use it --- awx/main/tests/functional/api/test_fact_versions.py | 11 ++--------- awx/main/tests/functional/api/test_fact_view.py | 11 ++--------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/awx/main/tests/functional/api/test_fact_versions.py b/awx/main/tests/functional/api/test_fact_versions.py index 84a3c0c04e..b203c3deff 100644 --- a/awx/main/tests/functional/api/test_fact_versions.py +++ b/awx/main/tests/functional/api/test_fact_versions.py @@ -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) diff --git a/awx/main/tests/functional/api/test_fact_view.py b/awx/main/tests/functional/api/test_fact_view.py index cb73ac7948..e6cd724d91 100644 --- a/awx/main/tests/functional/api/test_fact_view.py +++ b/awx/main/tests/functional/api/test_fact_view.py @@ -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)