Commit Graph

219 Commits

Author SHA1 Message Date
mike cullerton d43eb4d6f8 Tests for workflow spec reordering 2021-08-30 12:35:57 -04:00
mike cullerton 543fc1fb4a Start of tests for new reorder API endpoint
Modified example_data to include a display_order for example spec
2021-08-27 13:04:11 -04:00
mike cullerton cd3d17862a Add task_spec_name to a bunch of tests 2021-08-26 10:43:28 -04:00
nilez b9d4f6c436 assertEquals -> assertEqual 2021-08-16 10:18:29 -04:00
mike cullerton e0096ebc8e Test and BPMN to make sure we don't process when field is hidden, but do process when field is not hidden 2021-08-11 16:44:45 -04:00
Kelly McDonald 25319a0e6a Make changes to alembic process - fix test for new API 2021-08-02 08:59:24 -04:00
mike cullerton 097dd9f9a3 Included the failing test, with self.assertRaises
Reworded some of the comments
2021-07-28 11:22:45 -04:00
Kelly McDonald 217e61eed3 next_task returns the next available task, except when the task is completed when it returns the EndEvent -
The problem was that it was returning the first EndEvent it found, not the last one. This caused a problem when we had a CallActivity which has its own EndEvent.

Fixes #399
2021-07-27 09:19:08 -04:00
mike cullerton 2c892560ad Failing test for Call Activity End Events - Ticket 399 2021-07-26 12:12:01 -04:00
Dan 2a45f2fcda Merge branch 'dev' into add-name-error-hint-8 2021-07-07 11:24:00 -04:00
Dan fb54edac1c Adding additional details to error messages, and cleaning up the cruft around these messages to keep them clear and succinct.
Most noteable is the addition of the line on which the error occurs for script tasks.  It will report the line number and pass back the content of
the line that failed.
The validator only returns the first error it encounters, as it's clear that all we ever get right now is two of the same error.
Did a lot of work between this and spiffworkflow to remove all the places where we obfuscate or drop details as we converted between workflowExceptions and APIExceptions.
Dropped the python levenshtein dependency, in favor of just rolling a simple one ourselves in Spiffworkflow.
2021-07-07 00:53:49 -04:00
mike cullerton 2a43230121 Test and workflow for the new name error hint code 2021-07-01 15:39:25 -04:00
Dan Funk 19d63e2aa2
Merge pull request #328 from sartography/restart-workflow-programmatically-347
Restart workflow programmatically #347
2021-06-17 10:36:46 -04:00
Dan a4caae8d64 when validating, we need to take every step to remove the workflows we create during the validation. 2021-06-16 14:40:20 -04:00
mike cullerton 94e730d04e Test script validation 2021-06-15 11:15:31 -04:00
mike cullerton addf1cab5b Added tests for failing conditions 2021-06-15 10:30:18 -04:00
mike cullerton 9e20025f33 Test and workflow for reset_workflow 2021-06-15 08:37:42 -04:00
mike cullerton 9dc5871848 Added mocked PB data for tests using study_info script. 2021-06-07 10:08:44 -04:00
mike cullerton 37ba46fb8f These tests now require PB Mock because of the validate_study_id changes 2021-06-03 14:30:00 -04:00
Dan ef7ee284b2 Prefer tasks that share a parent over just the the next available task when returning the next_task in the workflow processor. 2021-05-19 16:26:16 -04:00
Dan Funk ade7812540
Merge pull request #310 from sartography/get-primary-workflow-301
Get primary workflow #301
2021-05-14 12:41:48 -04:00
mike cullerton 4c8ea14435 Fixed test - changed the method name 2021-05-12 14:07:54 -04:00
mike cullerton 8f8d9d30e4 Added test for get_primary_workflow 2021-05-12 13:52:18 -04:00
mike cullerton 67321ecd97 Test and workflow for persisting read-only data 2021-05-07 14:07:19 -04:00
mike cullerton 09d8c8bcba added missing test for update_workflow_spec_category 2021-04-26 12:57:08 -04:00
mike cullerton 0aa3e8f586 added missing test for add_workflow_spec_category 2021-04-26 12:41:50 -04:00
mike cullerton b73c2ff1cb Added missing test for `get_workflow_from_workflow_spec` 2021-04-26 12:00:06 -04:00
Mike Cullerton 39fcab3730
Merge branch 'dev' into launch-workflow-outside-study-204 2021-04-26 10:27:32 -04:00
mike cullerton 7cca559747 Fixed issue where we were passing in a workflow_api instead of a workflow when completing a form in tests. 2021-04-26 08:58:09 -04:00
mike cullerton c002ef1e76 Added test for new api endpoint to get all standalone workflow_specs.
Modified test_add_new_workflow_specification to include new standalone argument
2021-04-26 08:56:21 -04:00
mike cullerton 2d4a68da6d Added test for deleting files on restart. 2021-04-15 11:30:17 -04:00
Dan 6427a54d74 Set the correct default value on enumerations - if it is a multi-select enum (checkbox is set) then it should return a default value of an empty array, and not a dictionary. 2021-04-09 08:40:58 -04:00
mike cullerton 5155db89f9 Added test for deleting multiple files.
Fixed existing tests to accommodate changes to test workflow bpmn file
2021-04-05 15:13:32 -04:00
mike cullerton 33cef2bd2a Added tests for failing conditions 2021-04-05 13:19:29 -04:00
mike cullerton 9317e49e65 Merge branch 'dev' into delete-uploaded-file-script-283 2021-04-05 10:40:33 -04:00
mike cullerton d81497f8cb Test and workflow for new script to delete IRB documents 2021-04-05 08:55:41 -04:00
Dan dcb4e7b736 fixing an error by taking a bit of the magic out of one of Mike's regex hinting tools. I figure the hint is still good, and a little less bittle, and all the information is already there if people need to dig. 2021-04-02 17:58:27 -04:00
Dan 2100f27976 fixing the api.yml file which was starting to throw errors when updating the libraries.
Seems that sqlalchemy now has a hard time incrementing sequences, so putting in a fix for this.
Upgrading many of our libraries, to avoid any disconnects as we try to handle security patches from these automated bumps.
2021-04-02 17:10:05 -04:00
mike cullerton c4b52f85af Test and workflow for testing infinite loop code. 2021-03-17 14:52:50 -04:00
Dan 6f80d816cd My privous efforts didn't take into account the fact that we use dot notation in field names.
I've re-worked the workflow form endpoint, so that it only accepts the data that should be in the form, and ignores any other values that come back from the front end.  It seems Formly has some bugs that were introducing confusing information, and I want everything to behave consistently.
I had to re-work some of the tests, which were relying on an ability to set data through a form post without having a corresponding form to do so.
2021-03-14 12:20:39 -04:00
Dan 576aebab19 Sometimes a workflow can be completely broken and unloadable. For instance, it starts off with a engine step / script task that will not execute. So the failure happens the second it is processed. When calling reset on a workflow, we should catch the failure, and reset the workflow, so we aren't trapped in an unrecoverable state.
To do so, I changed the WorkflowProcessor's reset method to be static, it will try to instantiate the current workflow and execute a cancel_notify event, but if that fails, it will continue and always return a new workflow processor using the latest spec.
2021-03-09 11:52:55 -05:00
Dan 36dcc58705 Merge branch 'dev' of github.com:sartography/cr-connect-workflow into dev 2021-03-08 14:00:14 -05:00
Dan 291216e081 Fixing a bug that prevented proper evaluation of a enum field where the default value was null or empty. 2021-03-08 14:00:03 -05:00
mike cullerton f883eb2bbe We now include field.id in the ApiError message for hidden and default validation. (The field must have a default value or value expression)
While working on this ticket I found a logic error in the test. I expected both default_value and value_expression. It turns out the default_value is always there, it's just null if we don't set it.

Modified the existing test for hidden and required, and added tests to make sure my passing logic is now correct.
2021-03-04 10:42:13 -05:00
mike cullerton 9a2ffb98ad Customer Error is in a place that we can try it out on testing.
So far, there are two known errors.
 - Missing condition type (Ticket 178)
 - Invalid property value in extensions tab for display_name (No ticket for this error)

We now have the option of using regular expressions to pull task_id, etc. from an error to pass back to the user in the hint.
2021-03-01 16:41:55 -05:00
mike cullerton 9d804c36d5 Merge branch 'dev' into customer-error-messages-192.
Needed some sql changes from dev
2021-03-01 10:29:10 -05:00
mike cullerton f937ac3ce9 Getting some thoughts down for the extension property error. This might force us to use regexes for the error service.
Committing so I can work on another branch.
2021-02-24 10:56:25 -05:00
mike cullerton e0de1d0b3b Fixed 3 tests to reflect a change in crc.api.workflow.validate_workflow_specification.
Added a '\n' to the error message between the actual error and our preamble.
2021-02-19 15:55:40 -05:00
mike cullerton 446bff9c8c Modified test for missing default value on hidden and required fields to check for task_id and task_name 2021-02-15 16:28:51 -05:00
mike cullerton 34700568ee Added a test for allowing periods in field ids 2021-02-15 16:28:21 -05:00
mike cullerton 39eb5c5c21 This is a decent beginning framework for customer error messages.
It is not complete, but is in a state where we can start to interact with the front end.
Two tests are failing.
Committing so I can work on an error for Alex.
2021-02-12 14:18:42 -05:00
Dan Funk fe4e737596
Merge pull request #238 from sartography/value-expression-failing-shield-test-194
We now allow value_expression to evaluate to an empty string ("") so …
2021-02-11 11:25:09 -05:00
Dan Funk df25b83958
Merge pull request #235 from sartography/index-error-for-enums-186
Index error for enums 186
2021-02-11 11:21:50 -05:00
mike cullerton 39e874504f We now allow value_expression to evaluate to an empty string ("") so that we *do not* set a default value for enums in some cases.
This was causing an error because "" was not an option for the enum.
2021-02-10 14:35:58 -05:00
mike cullerton 11177b4296 Test, workflow, and empty spreadsheet for the new code. The workflow references the spreadsheet, which has no rows. 2021-02-08 15:12:11 -05:00
mike cullerton eb504465f6 Test and workflow for new code.
We test 2 things.
 - If a field can be hidden and required, it must have a default value or value_expression
 - If a field is hidden and required, make sure we use the default value
2021-02-08 10:20:05 -05:00
mike cullerton fa34bee18a First commit for cleaning up error messages for customers.
This is *not* in a working state.
Committing this so I can work on another ticket.
2021-02-04 11:23:05 -05:00
Dan Funk 329146237e
Merge pull request #232 from sartography/boolean-default-values-175
Boolean default values 175
2021-02-03 16:34:54 -05:00
Dan Funk effd11f947
Merge pull request #231 from sartography/cancellations-137
Cancellations 137
2021-02-03 16:31:18 -05:00
Dan Funk 1eba20f420
Merge pull request #229 from sartography/workflow-spec-order-74
Workflow spec order 74
2021-02-03 16:18:34 -05:00
mike cullerton 1247744463 Test and workflow for new code. 2021-02-03 09:50:37 -05:00
mike cullerton 6f7abc0a97 Added tests to test_workflow_restart to make sure we call cancel_notify events when appropriate. 2021-01-29 14:48:35 -05:00
mike cullerton c026717b4a Changed the call to WorkflowProcessor.reset to reflect the change from class method to instance method 2021-01-29 14:06:25 -05:00
mike cullerton 7b91fb9f61 Modified test to check for display_order within workflow category. 2021-01-27 11:08:28 -05:00
Dan Funk cccb722e07
Merge pull request #226 from sartography/enum_default_value_expression_162
Enum default value expression 162
2021-01-27 10:43:46 -05:00
mike cullerton 420ef0b2b0 Test and data for cleaning up my smell. We now test explicitly whether a task has both a default_value and value_expression. If so, we raise an error. 2021-01-27 10:22:43 -05:00
mike cullerton 2438779470 Test and workflow file for missing form key. Ticket 163 2021-01-22 12:14:59 -05:00
mike cullerton 1ee6a11d46 Test and associated data files for setting enum default values from value_expression. Ticket 162 2021-01-22 10:01:20 -05:00
Dan Funk 5b13195182
Merge pull request #224 from sartography/restart-with-no-data-99
Restart with no data 99
2021-01-20 17:22:18 -05:00
Dan 41dac33039 Removed two tests around soft_reset that are no longer required.
Reset should construct the workflow_processor, thus completing the reset process.
Removed the spec argument from init, as it is never used anywhere.
2021-01-20 13:24:53 -05:00
mike cullerton 61d366c111 Fixed hard_reset test. Now we reset the workflow and run do_engine_steps 2021-01-19 15:39:59 -05:00
mike cullerton 9281a93abb New test for new restart_workflow endpoint 2021-01-19 15:15:44 -05:00
mike cullerton 6a9e6d3570 Restart workflow without form data. Committing so Dan can check it out 2021-01-14 15:32:14 -05:00
mike cullerton 99c1d1b129 Test for changes to hard_reset and soft_reset 2021-01-13 16:12:14 -05:00
Dan 26655b26d3 merging in dev, and fixing a failing test from dev. 2021-01-08 14:42:13 -05:00
Dan Funk 9118517995
Merge pull request #220 from sartography/prevent-duplicate-template-upload-111
Users cannot upload a workflow_spec_file that already exists. We rais…
2021-01-08 13:55:19 -05:00
mike cullerton d274813ae5 We now check form field IDs so they play well with Python and Javascript. 2021-01-07 11:10:31 -05:00
mike cullerton c9a4a9685f Users cannot upload a workflow_spec_file that already exists. We raise an error that is displayed on the fron end. 2021-01-04 15:47:45 -05:00
mike cullerton 0ae4448fbe Fixed ApiError call. Now includes task_id and task_name. 2021-01-04 13:48:34 -05:00
mike cullerton 06318c87b1 Test and workflow for changes to workflow_service. The workflow does not have a field type. We look for evidence of raised exception in data of response. 2020-12-28 18:03:59 -05:00
Dan 6bf24cc438 fixing some failing tests related to changes in the underlying spiffworkflow library. 2020-12-14 11:27:38 -05:00
Dan 02ea414b94 Additional fixes to Navigation to allow a nested navigation structure. 2020-12-14 10:07:19 -05:00
Dan 93b12a8e82 updates using new navigation from spiff workflow's navigation branch, all tests passing. 2020-12-04 17:56:12 -05:00
Kelly McDonald 8b23cdc05c commit changes before switching branches 2020-10-09 08:46:14 -04:00
Dan Funk b2aede2b8d Glob on windows seems to return directories where in linux it does not, so now assuring we don't try to add files from the sub-directory. 2020-10-05 17:35:35 -04:00
Dan Funk b544334f45 1. Updating Personnel BPMN diagram to debug some issues.
2. Disabling the token timeout for now, to see if this corrects the issues Alex is having with lost work.
3. Raising more thoughtful error messages for unknown lookup options.
4. Providing better validation of default values and injecting the correct value for defaults related to enum lists of all types.
5. Bumping Spiffworkflow library which contains some better error messages and checks.
2020-09-01 15:58:50 -04:00
Dan Funk b39fd73bc0 fixing a failing test due to changes in the master bpmn for CRC 2020-08-27 14:06:03 -04:00
Dan Funk 53d09303d8 Validating that field properties are valid - they must exist as constants on the Task model.
Making all the lookup field names consistent.
Fixing the lookup service which was failing at times trying to find the correct field to use for building the lookup table.
Updating validation to check for additional fields and properties.
When connexion level errors occur, wrapping it in an API Error to be consistent.
2020-08-27 14:00:14 -04:00
Dan Funk 8f5488d910 Don't raise an error when validating workflows that use the ldap script. 2020-08-17 15:45:37 -04:00
Dan Funk 85ad477b2b Some minor cleanup on the study status and automatic events. I wanted to avoid having one database model automatically generating other database models as a side effect. The study service now has full responsiblity to recording study events.
To help in running tests, adding __init__.py methods to all the test directories.
2020-08-17 14:56:00 -04:00
Carlos Lopez 4f05d99cf0 Fixing typo 2020-08-14 08:48:08 -06:00
Carlos Lopez 369fe4bb35 Automatic events refactoring 2020-08-14 08:36:46 -06:00
Dan Funk 08c24b7441
Merge pull request #184 from sartography/PMI_fix
Pmi fix
2020-08-14 09:17:58 -04:00
Dan Funk 29f53e763c fixing other tests realted to lookups. 2020-08-13 20:27:51 -04:00
Kelly McDonald 1ab765b50b Add test for PMI problem 2020-08-06 10:29:14 -04:00
Aaron Louie c8881cbf91 Merge branch 'dev' into feature/approvals_dashboard_prototype 2020-07-31 12:17:22 -04:00
Dan Funk f15626033d Allow the workflow to be requested without making changes to the workflow - requires that you specify a read_only flag of true, otherwise it assumes that you want a fully prepared workflow with the next ready task set to run. 2020-07-28 13:33:38 -04:00
Kelly McDonald cc55aed89c Change exception name 2020-07-27 12:18:28 -04:00
Kelly McDonald 70ad3872a7 Fix several bugs, most had an issue with the bpmn document 2020-07-27 12:02:34 -04:00
Dan Funk 6caf44544c Merge branch 'dev' into cr-connect-92-scripting-enhancements
# Conflicts:
#	crc/static/bpmn/ind_supplement/ind_supplement.bpmn
#	tests/workflow/test_workflow_service.py
2020-07-20 13:01:23 -04:00
Dan Funk dd0f984347 Drop backwards compatibility of scripts. While this will cause some initial pain, it's less confusing and error prone, and we are still in the development phase of the project. Were this going straight to production we would likely want to keep this backwards compatibility.
Don't parse on spaces if this is python code, so we avoid any errors in processing - spaces should be valid.
2020-07-20 12:26:34 -04:00
Dan Funk 06430550c8 Dropping the RRT-Data-Fix, it should have come out already, but had a failing test, so pulling it out now rather than delve into what is going wrong with obsolete code. 2020-07-20 11:39:50 -04:00
Carlos Lopez fcb772c900 Reporting to Sentry all captured exceptions and enabling multiple environments 2020-07-19 16:40:33 -06:00
Aaron Louie e82532aad8 Updates IND workflow spec. Fixes validation process to return lookups for enum values. 2020-07-17 11:51:21 -04:00
Kelly McDonald de54b63e20 Process scripts with no shebang (#!) as a regular python script. If there is a shebang, we look up the class as we did before.
I've also made it so that it falls back if we accidentally forget to add a shebang to a study as this would be a breaking change.

With the fallback feature, it should work with unmodified bpmn documents.
2020-07-17 10:56:04 -04:00
Kelly McDonald ab5771024e Check in for sanity check 2020-07-17 09:24:53 -04:00
Aaron Louie d67105332f Merge branch 'dev' into feature/lanes_and_roles 2020-07-16 14:00:53 -04:00
Aaron Louie d0279a11e5 Fixes failing unit test 2020-07-15 17:44:46 -04:00
Aaron Louie 040a95281e Updates package hashes 2020-07-15 17:09:34 -04:00
Dan Funk c7662315aa Assure that any errors that occur during the do_engine_steps is correctly captured and returned to the end user or configurator with enough information for them to act on. 2020-07-15 11:16:35 -04:00
Dan Funk d85ca1ce51 Whenever a workflow is loaded or updated, add events to the TaskEvent table with assignments for the next set of ready tasks, along with who should complete those tasks.
Add the lane information to the Task model.
Drop the foreign key constraint on the user_uid in the task log, as we might create tasks for users before they ever log into the system.
Add a new endpoint to the API called task events.  It should be possible to query this and get a list of all tasks that need a users attention.
The task events returned include detailed information about the workflow and study as sub-models
Rename all the actions in event log to things that are easier to pass over the api as arguments, make this backwards compatible, updating existing names in the database via the migration.
Throughly test the navigation and task details as control of the workflow is passed between two lanes.
2020-07-14 22:16:44 -04:00
Dan Funk a48322ef6a Partial work on CR Connect Roles.
Adding checks in the API to assure the correct person is completeing a task based on the task's lane.
Adding lane to the Navigation item.
Adding a check to assure that unique user ids can be identified using task.data
Added some additional ldap entries to make testing and development easier.
Removed a big chunk of duplicate code from task_tests_api
Modified some of the helper functions to make it easier to test as specific users.
Added some additional bpmn models to the tests for testing lanes and roles.
2020-07-14 10:29:25 -04:00
Dan Funk 8a66128189 Bug fixes after bumping the version of Spiffworlflow to the latest - which has fixes for sequential multi-instance. 2020-07-06 15:34:24 -04:00
Dan Funk a5cef8775e * Modifying the StudyInfo script to return both "investigators" and "roles", the investigators argument will return only the current active investigators according to the protocol builder. The "roles" argument returns all possible roles - it is what "investigators" use to be.
* The Task.title returned to the front end will now attempt to process the "display_name" property for dot-notation syntax, making it possible to use this for multi-instance tasks,
  but will work in all cases where we want he title to change based on values in the data model.
* Fixing a bug the test_study_api where it wasn't updated when we made recent changes to the different states of a study.
*
2020-07-06 12:09:21 -04:00
Aaron Louie fe61333b7b Fixes typo 2020-06-26 12:31:15 -04:00
Aaron Louie 29b108673d Adds failing test exposing bug with getting data for multi-instance tasks 2020-06-26 11:51:27 -04:00
Dan Funk 150117587e Merge branch 'dev' into feature/parallel_multiinstance_tasks 2020-06-25 23:20:38 -04:00
Carlos Lopez 5327b469f6 Merge branch 'rrt/dev' into feature/emails-enhancement 2020-06-24 21:46:53 -06:00
Carlos Lopez ddf1f4640c Re-organizing tests file structure 2020-06-17 16:10:06 -06:00