def test_run_validate_invalid_args(self): """Should return output text indicating validate not run.""" expected = 'task not run' observed = validate_xform.wrapper(java_path='spam', validate_path='eggs', xform_path='ham') self.assertIn(expected, observed)
def test_run_validate_all_valid_args(self): """Should return success run header message.""" expected = "task was run" validate_path = validate_xform._locate_odk_validate() java_path = '' xform_path = self.fixtures.files["R1309 BEHAVE.xml"] patch_call = 'odk_tools.gui.wrappers.validate_xform._call_odk_validate' with patch(patch_call, MagicMock()): observed = validate_xform.wrapper( java_path=java_path, validate_path=validate_path, xform_path=xform_path) self.assertIn(expected, observed)
def test_run_validate_all_valid_args(self): """Should return success run header message.""" expected = "task was run" validate_path = validate_xform._locate_odk_validate() java_path = '' xform_path = self.fixtures.files["R1309 BEHAVE.xml"] patch_call = 'odk_tools.gui.wrappers.validate_xform._call_odk_validate' with patch(patch_call, MagicMock()): observed = validate_xform.wrapper(java_path=java_path, validate_path=validate_path, xform_path=xform_path) self.assertIn(expected, observed)
def test_xform_empty_question_label_patch_validates_ok(self): """Should pass validate step without errors.""" xlsform_path = self.fixtures.files["Q1302_BEHAVE.xlsx"] xform_path = xlsform_path.replace("xlsx", "xml") self.clean_up_file = xform_path generate_xform.wrapper(xlsform_path=xlsform_path) observed = validate_xform.wrapper( java_path='', validate_path=validate_xform._locate_odk_validate(), xform_path=xform_path) if isinstance(observed, list): observed = "".join(observed) expected = "Xform is valid" self.assertIn(expected, observed)
def validate_xform(master, java_path, validate_path, xform_path): """ Run the XForm validation, and put the result in the main textbox. Parameters. :param master: tkinter.Frame. Frame where master.output.textbox is. :param java_path: str. Optional path to java.exe, otherwise this is looked for in the envar JAVA_HOME. :param validate_path: str. Optional path to ODK_Validate.jar. This is packaged with the GUI but maybe a different version is desired. :param xform_path: str. Path to XLSForm to convert. """ result = validate_xform.wrapper(java_path=java_path.get(), validate_path=validate_path.get(), xform_path=xform_path.get()) master.output.textbox.insert(tkinter.END, result)
def validate_xform(master, java_path, validate_path, xform_path): """ Run the XForm validation, and put the result in the main textbox. Parameters. :param master: tkinter.Frame. Frame where master.output.textbox is. :param java_path: str. Optional path to java.exe, otherwise this is looked for in the envar JAVA_HOME. :param validate_path: str. Optional path to ODK_Validate.jar. This is packaged with the GUI but maybe a different version is desired. :param xform_path: str. Path to XLSForm to convert. """ result = validate_xform.wrapper( java_path=java_path.get(), validate_path=validate_path.get(), xform_path=xform_path.get()) master.output.textbox.insert(tkinter.END, result)
def test_run_validate_invalid_args(self): """Should return output text indicating validate not run.""" expected = 'task not run' observed = validate_xform.wrapper( java_path='spam', validate_path='eggs', xform_path='ham') self.assertIn(expected, observed)