def test_upload_document_invalid_component(self) -> None: with self.assertRaisesRegex(Exception, 'Provided component was not a FileUploadWidget'): label = 'my_label' ui = { 'contents': [ { "contents": { "label": label, "#t": "Some other thing" }, "label": label, "labelPosition": "ABOVE", "instructions": "", "instructionsPosition": "", "helpTooltip": "Upload an application or a multi-patch package", "requiredStyle": "", "skinName": "", "marginBelow": "", "accessibilityText": "", "#t": "FieldLayout" }, ] } sail_form = SailUiForm(self.task_set.appian.interactor, ui, self.process_model_form_uri) sail_form.upload_document_to_upload_field(label, 'fake_file')
def test_upload_document_missing_file(self) -> None: file = 'fake_file' with self.assertRaisesRegex(Exception, f"No such file or directory: '{file}'"): label = 'my_label' ui = { 'contents': [ { "label": label, "labelPosition": "ABOVE", "instructions": "", "instructionsPosition": "", "helpTooltip": "Upload an application or a multi-patch package", "requiredStyle": "", "skinName": "", "marginBelow": "", "accessibilityText": "", "#t": "FileUploadWidget" }, ] } sail_form = SailUiForm(self.task_set.appian.interactor, ui, self.process_model_form_uri) sail_form.upload_document_to_upload_field(label, file)