コード例 #1
0
def update_vet(id):
    first_name = request.form["first-name"]
    last_name = request.form["last-name"]
    job_title = request.form["job-title"]
    id = request.form["id"]
    vet = Vet(first_name, last_name, job_title, id)
    vet_repository.update(vet)
    return redirect("/vets")
コード例 #2
0
def create_vet():
    first_name = request.form["first-name"]
    print(first_name)
    last_name = request.form["last-name"]
    job_title = request.form["job-title"]
    new_vet = Vet(first_name, last_name, job_title)
    vet_repository.save(new_vet)
    return redirect("/vets")
コード例 #3
0
 def setUp(self):
     self.test_vet = Vet("Bob", "Wiseman", "Graduate")
     self.test_client = Client("Vic", "Simpson", "07777 777 777",
                               "123 Sesame Street", True, self.test_vet)
     self.test_patient = Patient("Rex", "05/05/2019", "Dog", "Bulldog",
                                 "Male", "Alive", self.test_vet,
                                 self.test_client, "02/11/2020",
                                 "05/11/2020")
     self.test_date = "2019-05-07"
コード例 #4
0
def select(id):
    sql = "SELECT * FROM vets WHERE id = %s"
    values = [id]
    results = run_sql(sql, values)
    if results is not None:
        result = results[0]
        vet = Vet(result["first_name"], result["last_name"],
                  result["job_title"], result["id"])
    return vet
コード例 #5
0
def select_all():
    vets = []
    sql = "SELECT * FROM vets"
    results = run_sql(sql)
    if results is not None:
        for row in results:
            vet = Vet(row["first_name"], row["last_name"], row["job_title"],
                      row["id"])
            vets.append(vet)
    return vets
コード例 #6
0
 def setUp(self):
     self.test_vet = Vet("Bob", "Wiseman", "Graduate")
     self.test_client = Client("Vic", "Simpson", "07777 777 777",
                               "123 Sesame Street", True, self.test_vet)
     self.test_patient = Patient("Rex", "05/05/2019", "Dog", "Bulldog",
                                 "Male", "Alive", self.test_vet,
                                 self.test_client, "02/11/2020",
                                 "05/11/2020")
     self.test_treatment = Treatment(
         "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
         "04/10/2020", self.test_patient, self.test_vet)
コード例 #7
0
 def setUp(self):
     self.test_vet = Vet("John", "Smith", "Senior Vet")
コード例 #8
0
from models.src.client import Client
from models.src.patient import Patient
from models.src.treatment import Treatment

import repositories.vet_repository as vet_repository
import repositories.client_repository as client_repository
import repositories.patient_repository as patient_repository
import repositories.treatment_repository as treatment_repository

treatment_repository.delete_all()
patient_repository.delete_all()
client_repository.delete_all()
vet_repository.delete_all()

# Vet Repo Tests
vet_1 = Vet("Lin", "McDonald", "Graduate Vet")
vet_2 = Vet("Sharon", "Perkins", "Practice Partner")
vet_1 = vet_repository.save(vet_1)
vet_2 = vet_repository.save(vet_2)
vet_list = vet_repository.select_all()
selected_vet = vet_repository.select(vet_list[0].id)
# vet_repository.delete(vet_list[1].id)
vet_1.first_name = "Mary"
vet_repository.update(vet_1)
vet_list = vet_repository.select_all()

# Client repo tests
client_1 = Client("James", "McBean", "07666666666",
                  "1 Baberton Mains Row, Edinburgh, EH12 1LS", True, vet_1)
client_2 = Client("Daniel", "Jackson", "07888888888",
                  "16 Duke Street, Glasgow, G5 2FH", False, vet_2)