From 79ce86bce56709dbdafc0223f66f4cbcc3544e8b Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sat, 18 May 2019 16:58:30 -0400 Subject: [PATCH] Fix Selenium DatasetPopulator for more interesting uploads. This is a bug, that interface consumes files and so should this method. --- test/selenium_tests/framework.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/selenium_tests/framework.py b/test/selenium_tests/framework.py index 480b9e801d8..385e7469132 100644 --- a/test/selenium_tests/framework.py +++ b/test/selenium_tests/framework.py @@ -532,9 +532,17 @@ class SeleniumSessionGetPostMixin(object): response = requests.get(full_url, data=data, cookies=self.selenium_test_case.selenium_to_requests_cookies()) return response - def _post(self, route, data={}): + def _post(self, route, data=None, files=None): full_url = self.selenium_test_case.build_url("api/" + route, for_selenium=False) - response = requests.post(full_url, data=data, cookies=self.selenium_test_case.selenium_to_requests_cookies()) + if data is None: + data = {} + + if files is None: + files = data.get("__files", None) + if files is not None: + del data["__files"] + + response = requests.post(full_url, data=data, cookies=self.selenium_test_case.selenium_to_requests_cookies(), files=files) return response def _delete(self, route, data={}):