def test_doctor_relations(self): repo = Repo(dal.session) doctor: Doctor = repo.get_doctor(id=1) self.assertIsNotNone(doctor) self.assertIsNotNone(doctor.jobdoctors) self.assertTrue(isinstance(doctor.jobdoctors, List)) self.assertTrue(len(doctor.jobdoctors), 1)
def test_get_job_none_candidate(self): repo = Repo(dal.session) doc3: Doctor = repo.get_doctor(id=96881373) # Eugeny Bobylev doc3.is_active = False # временно не доступен (temporarily unavailable) job: IncartJob = repo.get_incartjob( id="1") # у этого задания есть 2 обращения к док 1 и 2 doctor: Doctor = repo.get_job_candidate(job) self.assertIsNone(doctor)
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)
def test_get_nonexist_doctor(self): repo = Repo(dal.session) doctor = repo.get_doctor(id=-20000) self.assertIsNone(doctor)
def test_get_doctor(self): repo = Repo(dal.session) doctor = repo.get_doctor(id=1) self.assertIsNotNone(doctor) self.assertTrue(doctor.id, 1)