Ejemplo n.º 1
0
    def test_sample_template_checks(self):
        user = User('*****@*****.**')

        # If the user has access, this should not raise anything, so it will
        # keep the execution
        sample_template_checks(1, user)
        sample_template_checks(1, user, check_exists=True)

        # Test study doesn't exist
        with self.assertRaisesRegexp(HTTPError, 'Study does not exist'):
            sample_template_checks(1000000, user)

        # Test user doesn't have access to the study
        with self.assertRaisesRegexp(HTTPError,
                                     'User does not have access to study'):
            sample_template_checks(1, User('*****@*****.**'))

        # Test sample template doesn't exist
        new_study = self._create_study('Test Sample Template Checks')
        with self.assertRaisesRegexp(HTTPError,
                                     "Study %s doesn't have sample information"
                                     % new_study.id):
            sample_template_checks(new_study.id, user, check_exists=True)
Ejemplo n.º 2
0
    def test_sample_template_checks(self):
        user = User('*****@*****.**')

        # If the user has access, this should not raise anything, so it will
        # keep the execution
        sample_template_checks(1, user)
        sample_template_checks(1, user, check_exists=True)

        # Test study doesn't exist
        with self.assertRaisesRegexp(HTTPError, 'Study does not exist'):
            sample_template_checks(1000000, user)

        # Test user doesn't have access to the study
        with self.assertRaisesRegexp(HTTPError,
                                     'User does not have access to study'):
            sample_template_checks(1, User('*****@*****.**'))

        # Test sample template doesn't exist
        new_study = self._create_study('Test Sample Template Checks')
        with self.assertRaisesRegexp(
                HTTPError,
                "Study %s doesn't have sample information" % new_study.id):
            sample_template_checks(new_study.id, user, check_exists=True)