Esempio n. 1
0
 def test_update_jobdoctor(self):
     repo = Repo(dal.session)
     jobdoctor = repo.get_jobdoctor(doctor_id=1, job_id='1')
     jobdoctor.request_id = 23
     jobdoctor.request_started = datetime.datetime.now().astimezone(
         datetime.timezone.utc)
     ok: bool = repo.update_jobdoctor(jobdoctor)
     self.assertTrue(ok)
Esempio n. 2
0
 def test_get_jobdoctor(self):
     repo = Repo(dal.session)
     jobdoctor = repo.get_jobdoctor(doctor_id=1, job_id='1')
     self.assertIsNotNone(jobdoctor)
     self.assertTrue(isinstance(jobdoctor, JobDoctor))
     self.assertTrue(jobdoctor.doctor_id == 1)
     self.assertTrue(jobdoctor.job_id == '1')
     self.assertTrue(jobdoctor.doctor.id == 1)
     self.assertTrue(jobdoctor.job.id == '1')
Esempio n. 3
0
    def test_create_jobdoctor(self):
        repo = Repo(dal.session)
        job = IncartJob()
        job.id = '200'
        job.snippet = 'test job'
        doctor = repo.get_doctor(id=1)

        jobdoctor = JobDoctor()
        jobdoctor.job = job
        jobdoctor.doctor = doctor

        ok1: bool = repo.commit()
        self.assertTrue(ok1)
        jobdoctor2 = repo.get_jobdoctor(job_id=job.id, doctor_id=doctor.id)
        self.assertIsNotNone(jobdoctor2)
        self.assertEqual(jobdoctor.doctor_id, jobdoctor2.doctor_id)
        self.assertTrue(jobdoctor.job_id, jobdoctor2.job_id)
        self.assertNotEqual(jobdoctor, jobdoctor2)