mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Fixed a bug where we tried to delete a record that did not exist
This commit is contained in:
parent
e036d65ec6
commit
a21aea3348
@ -146,9 +146,9 @@ class DataStoreBase(object):
|
||||
elif study_id:
|
||||
query = query.filter(DataStoreModel.study_id == study_id)
|
||||
record = query.first()
|
||||
session.delete(record)
|
||||
session.commit()
|
||||
# return record
|
||||
if record is not None:
|
||||
session.delete(record)
|
||||
session.commit()
|
||||
|
||||
@staticmethod
|
||||
def delete_extra_data_stores(records):
|
||||
|
@ -275,3 +275,16 @@ class TestDataStoreValidation(BaseTest):
|
||||
self.assertEqual(3, len(result))
|
||||
for record in result:
|
||||
self.assertEqual('false', record.value)
|
||||
|
||||
def test_do_not_fail_deleting_record_that_does_not_exist(self):
|
||||
file_id = self.add_test_file()
|
||||
|
||||
workflow = self.create_workflow('data_store_set')
|
||||
workflow_api = self.get_workflow_api(workflow)
|
||||
task = workflow_api.next_task
|
||||
|
||||
# The workflow turns the string 'None' into the value None
|
||||
form_data = {'key': 'my_key', 'value': 'None', 'file_id': file_id}
|
||||
workflow_api = self.complete_form(workflow, task, form_data)
|
||||
task = workflow_api.next_task
|
||||
self.assertEqual('Event_EndEvent', task.name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user