From 4b947c11250042751ea7f4880dd0bf741bf6774e Mon Sep 17 00:00:00 2001 From: Diogenes Analytics Date: Sat, 16 Mar 2024 17:25:40 -0400 Subject: [PATCH] Fixing test to check for file input types first --- tests/test_website.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/test_website.py b/tests/test_website.py index fd442b6..5744fbc 100644 --- a/tests/test_website.py +++ b/tests/test_website.py @@ -295,14 +295,19 @@ def test_file_uploads_enabled( # open initial site sb.open(live_session_web_app_url) - # get form - form_element = sb.get_element("form") + # check for any input file types + file_inputs = sb.find_elements("input[type='file']") - # get the enctype attribute - enctype_value = form_element.get_attribute("enctype") + # only if inputs found + if file_inputs: + # get form + form_element = sb.get_element("form") - # make sure it's multipart - assert enctype_value == "multipart/form-data" + # get the enctype attribute + enctype_value = form_element.get_attribute("enctype") + + # make sure it's multipart + assert enctype_value == "multipart/form-data" @pytest.mark.website