Beispiel #1
0
 def test_study_get_req_no_access(self):
     obs = study_get_req(1, '*****@*****.**')
     exp = {
         'status': 'error',
         'message': 'User does not have access to study'
     }
     self.assertEqual(obs, exp)
Beispiel #2
0
    def test_study_get_req(self):
        obs = study_get_req(1, '*****@*****.**')
        exp = {
            'status': 'success',
            'study_info': {
                'mixs_compliant':
                True,
                'metadata_complete':
                True,
                'level':
                '',
                'reprocess':
                False,
                'owner':
                '*****@*****.**',
                'message':
                '',
                'emp_person_id':
                2,
                'number_samples_promised':
                27,
                'funding':
                None,
                'show_biom_download_button':
                True,
                'publication_pid': ['123456', '7891011'],
                'vamps_id':
                None,
                'first_contact':
                datetime(2014, 5, 19, 16, 10),
                'ebi_submission_status':
                'submitted',
                'show_raw_download_button':
                True,
                'timeseries_type_id':
                1,
                'study_abstract':
                ('This is a preliminary study to examine the microbiota '
                 'associated with the Cannabis plant. Soils samples from '
                 'the bulk soil, soil associated with the roots, and the '
                 'rhizosphere were extracted and the DNA sequenced. Roots '
                 'from three independent plants of different strains were '
                 'examined. These roots were obtained November 11, 2011 '
                 'from plants that had been harvested in the summer. '
                 'Future studies will attempt to analyze the soils and '
                 'rhizospheres from the same location at different time '
                 'points in the plant lifecycle.'),
                'status':
                'private',
                'spatial_series':
                False,
                'specimen_id_column':
                None,
                'study_description':
                ('Analysis of the Cannabis Plant Microbiome'),
                'shared_with': ['*****@*****.**'],
                'publication_doi': ['10.100/123456', '10.100/7891011'],
                'has_access_to_raw_data':
                True,
                'lab_person': {
                    'affiliation': 'knight lab',
                    'name': 'LabDude',
                    'email': '*****@*****.**'
                },
                'principal_investigator': {
                    'affiliation': 'Wash U',
                    'name': 'PIDude',
                    'email': '*****@*****.**'
                },
                'study_alias':
                'Cannabis Soils',
                'study_id':
                1,
                'most_recent_contact':
                datetime(2014, 5, 19, 16, 11),
                'ebi_study_accession':
                'EBI123456-BB',
                'num_samples':
                27,
                'study_title':
                ('Identification of the Microbiomes for Cannabis Soils'),
                'number_samples_collected':
                27
            },
            'message': '',
            'editable': True
        }
        self.assertEqual(obs, exp)

        # Test with no lab person
        info = {
            "timeseries_type_id": 1,
            "metadata_complete": True,
            "mixs_compliant": True,
            "number_samples_collected": 25,
            "number_samples_promised": 28,
            "study_alias": "FCM",
            "study_description": "DESC",
            "study_abstract": "ABS",
            "principal_investigator_id": qdb.study.StudyPerson(3),
            'first_contact': datetime(2015, 5, 19, 16, 10),
            'most_recent_contact': datetime(2015, 5, 19, 16, 11),
        }

        new_study = qdb.study.Study.create(qdb.user.User('*****@*****.**'),
                                           "Some New Study for test", info)

        obs = study_get_req(new_study.id, '*****@*****.**')
        exp = {
            'status': 'success',
            'message': '',
            'study_info': {
                'mixs_compliant': True,
                'metadata_complete': True,
                'reprocess': False,
                'emp_person_id': None,
                'number_samples_promised': 28,
                'funding': None,
                'vamps_id': None,
                'first_contact': datetime(2015, 5, 19, 16, 10),
                'timeseries_type_id': 1,
                'study_abstract': 'ABS',
                'status': 'private',
                'spatial_series': False,
                'study_description': 'DESC',
                'shared_with': [],
                'lab_person': None,
                'study_alias': "FCM",
                'owner': 'Dude',
                'principal_investigator': {
                    'affiliation': 'Wash U',
                    'name': 'PIDude',
                    'email': '*****@*****.**'
                },
                'study_alias': 'FCM',
                'study_id': new_study.id,
                'most_recent_contact': datetime(2015, 5, 19, 16, 11),
                'publication_doi': [],
                'publication_pid': [],
                'num_samples': 25,
                'study_title': 'Some New Study',
                'number_samples_collected': 27
            },
            'editable': True
        }
        self.assertItemsEqual(obs, exp)
Beispiel #3
0
 def test_study_get_req_no_exists(self):
     obs = study_get_req(4000, '*****@*****.**')
     exp = {'status': 'error', 'message': 'Study does not exist'}
     self.assertEqual(obs, exp)
Beispiel #4
0
    def test_study_get_req(self):
        obs = study_get_req(1, '*****@*****.**')
        exp = {
            'status': 'success',
            'study_info': {
                'mixs_compliant': True, 'metadata_complete': True, 'level': '',
                'reprocess': False, 'owner': '*****@*****.**', 'message': '',
                'emp_person_id': 2, 'number_samples_promised': 27,
                'funding': None, 'show_biom_download_button': True,
                'publication_pid': ['123456', '7891011'], 'vamps_id': None,
                'first_contact': datetime(2014, 5, 19, 16, 10),
                'ebi_submission_status': 'submitted',
                'show_raw_download_button': True, 'timeseries_type_id': 1,
                'study_abstract': (
                    'This is a preliminary study to examine the microbiota '
                    'associated with the Cannabis plant. Soils samples from '
                    'the bulk soil, soil associated with the roots, and the '
                    'rhizosphere were extracted and the DNA sequenced. Roots '
                    'from three independent plants of different strains were '
                    'examined. These roots were obtained November 11, 2011 '
                    'from plants that had been harvested in the summer. '
                    'Future studies will attempt to analyze the soils and '
                    'rhizospheres from the same location at different time '
                    'points in the plant lifecycle.'),
                'status': 'private', 'spatial_series': False,
                'study_description': (
                    'Analysis of the Cannabis Plant Microbiome'),
                'shared_with': ['*****@*****.**'], 'publication_doi': [
                    '10.100/123456', '10.100/7891011'],
                'has_access_to_raw_data': True, 'lab_person': {
                    'affiliation': 'knight lab', 'name': 'LabDude',
                    'email': '*****@*****.**'},
                'principal_investigator': {
                    'affiliation': 'Wash U', 'name': 'PIDude',
                    'email': '*****@*****.**'},
                'study_alias': 'Cannabis Soils', 'study_id': 1,
                'most_recent_contact': datetime(2014, 5, 19, 16, 11),
                'ebi_study_accession': 'EBI123456-BB', 'num_samples': 27,
                'study_title': (
                    'Identification of the Microbiomes for Cannabis Soils'),
                'number_samples_collected': 27},
            'message': '',
            'editable': True}
        self.assertEqual(obs, exp)

        # Test with no lab person
        info = {
            "timeseries_type_id": 1,
            "metadata_complete": True,
            "mixs_compliant": True,
            "number_samples_collected": 25,
            "number_samples_promised": 28,
            "study_alias": "FCM",
            "study_description": "DESC",
            "study_abstract": "ABS",
            "principal_investigator_id": qdb.study.StudyPerson(3),
            'first_contact': datetime(2015, 5, 19, 16, 10),
            'most_recent_contact': datetime(2015, 5, 19, 16, 11),
        }

        new_study = qdb.study.Study.create(
            qdb.user.User('*****@*****.**'), "Some New Study for test", info)

        obs = study_get_req(new_study.id, '*****@*****.**')
        exp = {
            'status': 'success',
            'message': '',
            'study_info': {
                'mixs_compliant': True,
                'metadata_complete': True,
                'reprocess': False,
                'emp_person_id': None,
                'number_samples_promised': 28,
                'funding': None,
                'vamps_id': None,
                'first_contact': datetime(2015, 5, 19, 16, 10),
                'timeseries_type_id': 1,
                'study_abstract': 'ABS',
                'status': 'private',
                'spatial_series': False,
                'study_description': 'DESC',
                'shared_with': [],
                'lab_person': None,
                'study_alias': "FCM",
                'owner': 'Dude',
                'principal_investigator': {'affiliation': 'Wash U',
                                           'name': 'PIDude',
                                           'email': '*****@*****.**'},
                'study_alias': 'FCM',
                'study_id': new_study.id,
                'most_recent_contact': datetime(2015, 5, 19, 16, 11),
                'publication_doi': [],
                'publication_pid': [],
                'num_samples': 25,
                'study_title': 'Some New Study',
                'number_samples_collected': 27},
            'editable': True}
        self.assertItemsEqual(obs, exp)
Beispiel #5
0
 def test_study_get_req_no_exists(self):
     obs = study_get_req(4000, '*****@*****.**')
     exp = {'status': 'error',
            'message': 'Study does not exist'}
     self.assertEqual(obs, exp)
Beispiel #6
0
 def test_study_get_req_no_access(self):
     obs = study_get_req(1, '*****@*****.**')
     exp = {'status': 'error',
            'message': 'User does not have access to study'}
     self.assertEqual(obs, exp)