def guess_doctor_by_name(doc_name): # partial matches suggest # No matches prompt to renter at, rt = utility.get_token() result = fields.get_doctors_by_name(at, doc_name) count, doctors = result.get("response").get('count', 0), result.get("response").get( 'doctors', []) # compose template return result
def date_for_doctor_hospital(doc_id, hospital_id): at, rt = utility.get_token() result = fields.get_session_by_doctor_hospital(at, doc_id, hospital_id) count, doctors = result.get("response").get('count', 0), result.get("response").get( 'doctors', []) if count < 1: pass elif count == 1: pass else: pass return
def hospital_for_doctor(doc_name, doc_id): at, rt = utility.get_token() result = fields.get_doctors_by_name(at, doc_name) count, doctors = result.get("response").get('count', 0), result.get("response").get( 'doctors', []) if count < 1: pass elif count == 1: pass else: pass return
def find_doctor_by_name(doc_name): # exact/partial matches suggest # No matches prompt to renter at, rt = utility.get_token() result = fields.get_doctors_by_name(at, doc_name) count, doctors = result.get("response").get('count', 0), result.get("response").get( 'doctors', []) if count < 1: result = {"option": "no-result"} elif count == 1: result = { "option": "matched", "values": { "doctor-id": "01", "doctor-name": "Amal Perera" } } elif 0 < count < 10: result = {"option": "guess"} else: result = {"option": "vague"} return result
def refresh_token(): at, rt = utility.get_token()
import unittest, json import fields, utility at, rt = utility.get_token() class TestBotActions(unittest.TestCase): def test_get_payment_methods(self): self.assertRaises(fields.get_payment_methods(at)) # # def test_get_hospital_list(self): # self.assertRaises(fields.get_hospital_list(at)) # # def test_get_doctor_list(self): # self.assertRaises(fields.get_doctor_list(at)) # # def test_get_specialization_list(self): # self.assertRaises(fields.get_specialization_list(at)) class TestBotActions2(unittest.TestCase): # def test_get_doctors_by_name(self): # self.assertRaises(fields.get_doctors_by_name(at, "NIMALI FERNANDO")) # def test_get_session_by_doctor_hospital(self): # self.assertRaises(fields.get_session_by_doctor_hospital(at, 147, 70)) def test_get_session_availability(self):