Skip to content

Commit

Permalink
fix sheet template creation with slash in id/title field (#1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Feb 9, 2024
1 parent e418362 commit a3100ca
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Fixed
- ``IrodsDataRequest`` user changed on object update (#1864)
- ``IrodsDataRequest._validate_action()`` failing with ``delete`` action (#1858)
- Protocol ref editable for new row if disabled in column config (#1875)
- Sheet template creation failure with slash characters in title/ID fields (#1896)
- **Taskflowbackend**
- Hardcoded iRODS path length in ``landing_zone_move`` (#1888)

Expand Down
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ pronto==2.5.0 # For OWL conversion

# CUBI ISA-Tab templates
cookiecutter==2.2.3
cubi-isa-templates==0.1.1
# -e git+https://github.com/bihealth/cubi-isa-templates.git@c4139e147fd5db10bd6478460edbbce157abe425#egg=cubi-isa-templates
# cubi-isa-templates==0.1.1
-e git+https://github.com/bihealth/cubi-isa-templates.git@d3ebe866f3823d81fdb358042ef7ed4d8b8fd100#egg=cubi-isa-templates

# Taskflow requirements
tooz==3.0.0
Expand Down
29 changes: 29 additions & 0 deletions samplesheets/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
EDIT_NEW_VALUE_STR = 'edited value'
DUMMY_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
IRODS_FILE_PATH = '/sodarZone/path/test1.txt'
TPL_FILE_NAME_FIELDS = [
'investigation_title',
'investigation_id',
'study_title',
]
with open(CONFIG_PATH_DEFAULT) as fp:
CONFIG_DATA_DEFAULT = json.load(fp)

Expand Down Expand Up @@ -796,6 +801,30 @@ def test_post_batch(self):
)
self.project.investigations.first().delete()

def test_post_batch_file_name_slash(self):
"""Test POST with slashes in values used for file names"""
for t in ISA_TEMPLATES:
self.assertIsNone(self.project.investigations.first())
post_data = self._get_post_data(t)
for k in TPL_FILE_NAME_FIELDS:
if k in post_data:
post_data[k] += '/test'
with self.login(self.user):
response = self.client.post(
reverse(
'samplesheets:template_create',
kwargs={'project': self.project.sodar_uuid},
)
+ '?sheet_tpl='
+ t.name,
data=post_data,
)
self.assertEqual(response.status_code, 302, msg=t.name)
self.assertIsNotNone(
self.project.investigations.first(), msg=t.name
)
self.project.investigations.first().delete()

def test_post_multiple(self):
"""Test multiple requests to add multiple sample sheets (should fail)"""
tpl = ISA_TEMPLATES[0]
Expand Down

0 comments on commit a3100ca

Please sign in to comment.