コード例 #1
0
    def test_request_callback_two_operators(self, mock_get_request_samples,
                                            mock_create_jobs_from_request):
        # mock_get_request_samples.return_value = {'recipe': 'TestAssay'}
        file_conflict = File.objects.create(
            path=
            "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
            file_type=self.fastq,
            file_group=self.file_group,
        )
        file_metadata = FileMetadata.objects.create(file=file_conflict,
                                                    version=1,
                                                    metadata={
                                                        'requestId':
                                                        'test1',
                                                        'recipe':
                                                        'TestAssay',
                                                        'labHeadEmail':
                                                        '*****@*****.**'
                                                    })
        operator1 = Operator.objects.create(slug="Operator1",
                                            class_name="Operator",
                                            recipes=['TestAssay'],
                                            active=True)
        operator2 = Operator.objects.create(slug="Operator2",
                                            class_name="Operator",
                                            recipes=['TestAssay'],
                                            active=True)
        request_callback('test1')

        calls = [
            call('test1', operator1.id, None),
            call('test1', operator2.id, None)
        ]

        mock_create_jobs_from_request.assert_has_calls(calls, any_order=True)
コード例 #2
0
ファイル: test_lims_etl_jobs.py プロジェクト: mskcc/beagle
    def test_request_callback(self, mock_get_request_samples,
                              mock_create_jobs_from_request):
        # mock_get_request_samples.return_value = {'recipe': 'TestAssay'}
        file_conflict = File.objects.create(
            path=
            "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
            file_type=self.fastq,
            file_group=self.file_group,
        )
        file_metadata = FileMetadata.objects.create(
            file=file_conflict,
            version=1,
            metadata={
                "requestId": "test1",
                "recipe": "TestAssay",
                "labHeadEmail": "*****@*****.**"
            },
        )
        operator1 = Operator.objects.create(slug="Operator1",
                                            class_name="Operator",
                                            recipes=["TestAssay"],
                                            active=True)
        request_callback("test1")

        mock_create_jobs_from_request.assert_called_once_with(
            "test1", operator1.id, None)
コード例 #3
0
    def test_request_callback_unknown_assay(self, mock_get_request_samples,
                                            mock_send_notification):
        # mock_get_request_samples.return_value = {'recipe': 'UnknownAssay'}
        job_group = JobGroup.objects.create()
        notifier = Notifier.objects.create(default=False,
                                           notifier_type="JIRA",
                                           board="IMPORT")
        job_group_notifier = JobGroupNotifier.objects.create(
            job_group=job_group, notifier_type=notifier)
        file_conflict = File.objects.create(
            path=
            "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
            file_type=self.fastq,
            file_group=self.file_group,
        )
        file_metadata = FileMetadata.objects.create(file=file_conflict,
                                                    version=1,
                                                    metadata={
                                                        'requestId':
                                                        'test1',
                                                        'recipe':
                                                        'UnknownAssay',
                                                        'labHeadEmail':
                                                        '*****@*****.**'
                                                    })
        request_callback('test1', str(job_group.id),
                         str(job_group_notifier.id))

        calls = [
            call({
                'class': 'SetCIReviewEvent',
                'job_notifier': str(job_group_notifier.id)
            }),
            call({
                'class': 'SetLabelEvent',
                'job_notifier': str(job_group_notifier.id),
                'label': 'unrecognized_assay'
            }),
            call({
                'class': 'UnknownAssayEvent',
                'job_notifier': str(job_group_notifier.id),
                'assay': 'UnknownAssay'
            })
        ]

        mock_send_notification.assert_has_calls(calls, any_order=True)
コード例 #4
0
    def test_request_callback(self, mock_create_jobs_from_request):
        file_conflict = File.objects.create(
            path=
            "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
            file_type=self.fastq,
            file_group=self.file_group,
        )
        file_metadata = FileMetadata.objects.create(file=file_conflict,
                                                    version=1,
                                                    metadata={
                                                        'requestId': 'test1',
                                                        'recipe': 'TestAssay'
                                                    })
        operator1 = Operator.objects.create(slug="Operator1",
                                            class_name="Operator",
                                            recipes=['TestAssay'],
                                            active=True)
        request_callback('test1')

        mock_create_jobs_from_request.assert_called_once_with(
            'test1', operator1.id, None)
コード例 #5
0
ファイル: test_lims_etl_jobs.py プロジェクト: mskcc/beagle
    def test_request_callback_disabled_assay(self, mock_get_request_samples,
                                             mock_send_notification):
        # mock_get_request_samples.return_value = {'recipe': "DisabledAssay1"}
        job_group = JobGroup.objects.create()
        notifier = Notifier.objects.create(default=False,
                                           notifier_type="JIRA",
                                           board="IMPORT")
        job_group_notifier = JobGroupNotifier.objects.create(
            job_group=job_group, notifier_type=notifier)
        file_conflict = File.objects.create(
            path=
            "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
            file_type=self.fastq,
            file_group=self.file_group,
        )
        file_metadata = FileMetadata.objects.create(
            file=file_conflict,
            version=1,
            metadata={
                "requestId": "test1",
                "recipe": "DisabledAssay1",
                "labHeadEmail": "*****@*****.**"
            },
        )
        request_callback("test1", str(job_group.id),
                         str(job_group_notifier.id))

        calls = [
            call({
                "class": "NotForCIReviewEvent",
                "job_notifier": str(job_group_notifier.id)
            }),
            call({
                "class": "DisabledAssayEvent",
                "job_notifier": str(job_group_notifier.id),
                "assay": "DisabledAssay1"
            }),
        ]

        mock_send_notification.assert_has_calls(calls, any_order=True)
コード例 #6
0
    def test_request_callback_disabled_assay(self, mock_send_notification):
        job_group = JobGroup.objects.create()
        notifier = Notifier.objects.create(default=False,
                                           notifier_type="JIRA",
                                           board="IMPORT")
        job_group_notifier = JobGroupNotifier.objects.create(
            job_group=job_group, notifier_type=notifier)
        file_conflict = File.objects.create(
            path=
            "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
            file_type=self.fastq,
            file_group=self.file_group,
        )
        file_metadata = FileMetadata.objects.create(file=file_conflict,
                                                    version=1,
                                                    metadata={
                                                        'requestId': 'test1',
                                                        'recipe':
                                                        'DisabledAssay1'
                                                    })
        request_callback('test1', str(job_group.id),
                         str(job_group_notifier.id))

        calls = [
            call({
                'class': 'NotForCIReviewEvent',
                'job_notifier': str(job_group_notifier.id)
            }),
            call({
                'class': 'DisabledAssayEvent',
                'job_notifier': str(job_group_notifier.id),
                'assay': 'DisabledAssay1'
            })
        ]

        mock_send_notification.assert_has_calls(calls, any_order=True)