예제 #1
0
    def testXMLCheckALAJobStatusIdNotInt(self):
        lsid = 'urn:lsid:biodiversity.org.au:afd.taxon:31a9b8b8-4e8f-4343-a15f-2ed24e0bf1ae'
        context = None
        request = None
        service = DataMoverServices(context, request)

        job = ALAJob(lsid)
        job.id = 1
        service._ala_job_dao.findById = MagicMock(return_value=job)

        response = service.checkALAJobStatus('one')
        self.assertEqual('REJECTED', response['status'])
        self.assertEqual('Invalid parameters', response['reason'])
예제 #2
0
    def testXMLCheckALAJobStatus(self):
        lsid = 'urn:lsid:biodiversity.org.au:afd.taxon:31a9b8b8-4e8f-4343-a15f-2ed24e0bf1ae'
        context = None
        request = None
        service = DataMoverServices(context, request)

        job = ALAJob(lsid)
        job.id = 1
        service._ala_job_dao.findById = MagicMock(return_value=job)

        response = service.checkALAJobStatus(1)
        self.assertEqual(1, response['id'])
        self.assertEqual('PENDING', response['status'])
예제 #3
0
    def testXMLPullOccurrencesFromALASuccess(self):
        lsid = 'urn:lsid:biodiversity.org.au:afd.taxon:31a9b8b8-4e8f-4343-a15f-2ed24e0bf1ae'
        context = None
        request = None

        newJob = ALAJob(lsid)
        newJob.status = 'PENDING'

        service = DataMoverServices(context, request)

        session = MagicMock(spec=scoped_session)
        service._ala_job_dao._session_maker.generate_session = MagicMock(return_value=session)
        service._ala_service = MagicMock(spec=ALAService)
        response = service.pullOccurrenceFromALA(lsid)
        self.assertEqual('PENDING', response['status'])
        service._ala_job_dao._session_maker.generate_session.assert_called()
예제 #4
0
    def test_eq_ne(self):
        ala_job_1 = ALAJob(None)
        ala_job_1.id = 1

        ala_job_2 = ALAJob(None)
        ala_job_2.id = 2

        ala_job_3 = ALAJob(None)
        ala_job_3.id = 1

        self.assertFalse(ala_job_1 == ala_job_2)
        self.assertFalse(ala_job_2 == ala_job_3)
        self.assertTrue(ala_job_1 == ala_job_3)
        self.assertTrue(ala_job_1 == ala_job_1)

        self.assertTrue(ala_job_1 != ala_job_2)
        self.assertTrue(ala_job_2 != ala_job_3)
        self.assertFalse(ala_job_1 != ala_job_3)
        self.assertFalse(ala_job_1 != ala_job_1)

        self.assertFalse(ala_job_1 == "Some String")
        self.assertTrue(ala_job_1 != "Some String")