-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"""Plugin tests for the the meta_ms assay plugin""" | ||
|
||
import os | ||
|
||
from copy import deepcopy | ||
|
||
from samplesheets.assayapps.tests.base import AssayPluginTestBase | ||
from samplesheets.rendering import SIMPLE_LINK_TEMPLATE | ||
from samplesheets.views import MISC_FILES_COLL, RESULTS_COLL | ||
|
||
|
||
# Local constants | ||
RAW_DATA_COLL = 'RawData' | ||
REPORT_NAME = 'report.txt' | ||
FILE_NAME = 'file1.txt' | ||
FILE_NAME2 = 'file2.txt' | ||
|
||
|
||
class TestMetaMSAssayPlugin(AssayPluginTestBase): | ||
"""Tests for meta_ms assay plugin""" | ||
|
||
plugin_name = 'samplesheets_assay_meta_ms' | ||
template_name = 'ms_meta_biocrates' | ||
|
||
def test_get_row_path(self): | ||
"""Test get_row_path()""" | ||
row_path = self.plugin.get_row_path( | ||
self.assay_table['table_data'][0], | ||
self.assay_table, | ||
self.assay, | ||
self.assay_path, | ||
) | ||
expected = os.path.join(self.assay_path, RAW_DATA_COLL) | ||
self.assertEqual(row_path, expected) | ||
|
||
def test_update_row(self): | ||
"""Test update_row()""" | ||
self.assay_table['table_data'][0][44]['value'] = FILE_NAME | ||
self.assay_table['table_data'][0][51]['value'] = FILE_NAME2 | ||
self.assay_table['table_data'][0][55]['value'] = REPORT_NAME | ||
row_ex = deepcopy(self.assay_table['table_data'][0]) | ||
row_ex[44]['link'] = os.path.join( | ||
self.base_url, RAW_DATA_COLL, FILE_NAME | ||
) | ||
row_ex[51]['link'] = os.path.join( | ||
self.base_url, MISC_FILES_COLL, FILE_NAME2 | ||
) | ||
row_ex[55]['value'] = SIMPLE_LINK_TEMPLATE.format( | ||
label=REPORT_NAME, | ||
url=os.path.join(self.base_url, RESULTS_COLL, REPORT_NAME), | ||
) | ||
row = self.plugin.update_row( | ||
self.assay_table['table_data'][0], self.assay_table, self.assay, 0 | ||
) | ||
self.assertEqual(row, row_ex) | ||
|
||
# TODO: Test with empty file names after fixing #2017 | ||
|
||
def test_get_shortcuts(self): | ||
"""Test get_shortcuts()""" | ||
expected = { | ||
'id': 'raw_data', | ||
'label': 'Raw Data', | ||
'path': os.path.join(self.assay_path, RAW_DATA_COLL), | ||
} | ||
self.assertEqual(self.plugin.get_shortcuts(self.assay), [expected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters