|
10 | 10 |
|
11 | 11 | from qiita_core.util import qiita_test_checker
|
12 | 12 | from qiita_db.meta_util import get_accessible_filepath_ids
|
| 13 | +from qiita_db.study import Study |
| 14 | +from qiita_db.user import User |
13 | 15 |
|
14 | 16 |
|
15 | 17 | @qiita_test_checker()
|
@@ -40,5 +42,29 @@ def test_get_accessible_filepath_ids(self):
|
40 | 42 | obs = get_accessible_filepath_ids( '[email protected]')
|
41 | 43 | self.assertEqual(obs, set())
|
42 | 44 |
|
| 45 | + # Test that it doesn't brake if the SampleTemplate hasn't been added |
| 46 | + exp = set([1, 2, 3, 4, 5, 6, 7, 11, 14, 15, 16]) |
| 47 | + obs = get_accessible_filepath_ids( '[email protected]') |
| 48 | + self.assertEqual(obs, exp) |
| 49 | + |
| 50 | + info = { |
| 51 | + "timeseries_type_id": 1, |
| 52 | + "metadata_complete": True, |
| 53 | + "mixs_compliant": True, |
| 54 | + "number_samples_collected": 4, |
| 55 | + "number_samples_promised": 4, |
| 56 | + "portal_type_id": 3, |
| 57 | + "study_alias": "TestStudy", |
| 58 | + "study_description": "Description of a test study", |
| 59 | + "study_abstract": "No abstract right now...", |
| 60 | + "emp_person_id": 1, |
| 61 | + "principal_investigator_id": 1, |
| 62 | + "lab_person_id": 1 |
| 63 | + } |
| 64 | + Study. create( User( '[email protected]'), "Test study", [ 1], info) |
| 65 | + obs = get_accessible_filepath_ids( '[email protected]') |
| 66 | + self.assertEqual(obs, exp) |
| 67 | + |
| 68 | + |
43 | 69 | if __name__ == '__main__':
|
44 | 70 | main()
|
0 commit comments