def test_regimen_crud(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") aid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") data = { "startdate": base.today_display(), "treatmentname": "Test", "dosage": "Test", "timingrule": "1", "timingrulenofrequencies": "1", "timingrulefrequency": "1", "totalnumberoftreatments": "1", "treatmentrule": "1", "singlemulti": "1" } post = utils.PostedData(data, "en") mid = medical.insert_regimen_from_form(base.get_dbo(), "test", post) medical.update_regimen_from_form(base.get_dbo(), "test", post) medical.delete_regimen(base.get_dbo(), "test", mid) animal.delete_animal(base.get_dbo(), "test", aid)
def test_transport_crud(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") aid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") data = { "animal": "1", "driver": "1", "pickup": "1", "dropoff": "1", "pickupdate": base.today_display(), "dropoffdate": base.today_display(), "status": "1" } post = utils.PostedData(data, "en") tid = movement.insert_transport_from_form(base.get_dbo(), "test", post) post.data["transportid"] = str(tid) movement.update_transport_from_form(base.get_dbo(), "test", post) movement.delete_transport(base.get_dbo(), "test", tid) animal.delete_animal(base.get_dbo(), "test", aid)
def test_execute_diary_task(self): data = { "animalname": "TestioDiary", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") animalid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") data = { "name": "Test", "type": "0" } post = utils.PostedData(data, "en") headid = diary.insert_diarytaskhead_from_form(base.get_dbo(), "test", post) diary.update_diarytaskhead_from_form(base.get_dbo(), "test", post) data = { "taskid": str(headid), "daypivot": "1", "whofor": "user", "subject": "Testtask", "note": "Testtasknote" } post = utils.PostedData(data, "en") diary.insert_diarytaskdetail_from_form(base.get_dbo(), "test", post) diary.update_diarytaskdetail_from_form(base.get_dbo(), "test", post) diary.execute_diary_task(base.get_dbo(), "test", diary.ANIMAL, headid, animalid, base.today()) diary.delete_diarytask(base.get_dbo(), "test", headid) animal.delete_animal(base.get_dbo(), "test", animalid)
def test_attach_file_from_form(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") nid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") f = open(base.PATH + "../src/media/reports/nopic.jpg", "rb") data = f.read() f.close() post = utils.PostedData({ "base64image": "data:" + base64.b64encode(data) }, "en") media.attach_file_from_form(base.get_dbo(), "test", media.ANIMAL, nid, post) animal.delete_animal(base.get_dbo(), "test", nid)
def test_vaccination_crud(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") aid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") data = { "animal": str(aid), "required": base.today_display(), "type": "1" } post = utils.PostedData(data, "en") vid = medical.insert_vaccination_from_form(base.get_dbo(), "test", post) medical.update_vaccination_from_form(base.get_dbo(), "test", post) medical.delete_regimen(base.get_dbo(), "test", vid) animal.delete_animal(base.get_dbo(), "test", aid)
def test_movement_crud(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") aid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") data = { "animal": str(aid), "person": 1, "movementdate": base.today_display(), "type": "1", } post = utils.PostedData(data, "en") mid = movement.insert_movement_from_form(base.get_dbo(), "test", post) post.data["movementid"] = str(mid) movement.update_movement_from_form(base.get_dbo(), "test", post) movement.delete_movement(base.get_dbo(), "test", mid) animal.delete_animal(base.get_dbo(), "test", aid)
def test_test_crud(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") aid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") data = { "animal": str(aid), "required": base.today_display(), "type": "1", "result": "1" } post = utils.PostedData(data, "en") tid = medical.insert_test_from_form(base.get_dbo(), "test", post) post.data["testid"] = str(tid) medical.update_test_from_form(base.get_dbo(), "test", post) medical.delete_test(base.get_dbo(), "test", tid) animal.delete_animal(base.get_dbo(), "test", aid)
def test_attach_file_from_form(self): data = { "animalname": "Testio", "estimatedage": "1", "animaltype": "1", "entryreason": "1", "species": "1" } post = utils.PostedData(data, "en") nid, code = animal.insert_animal_from_form(base.get_dbo(), post, "test") f = open(base.PATH + "../src/media/reports/nopic.jpg", "rb") data = f.read() f.close() post = utils.PostedData( { "filename": "image.jpg", "filetype": "image/jpeg", "filedata": "data:image/jpeg;base64," + base64.b64encode(data) }, "en") media.attach_file_from_form(base.get_dbo(), "test", media.ANIMAL, nid, post) animal.delete_animal(base.get_dbo(), "test", nid)
def tearDown(self): animal.delete_animal(base.get_dbo(), "test", self.nid)
def test_clone_animal(self): nid = animal.clone_animal(base.get_dbo(), "test", self.nid) assert nid != 0 animal.delete_animal(base.get_dbo(), "test", nid)
def test_create_animal_from_found(self): aid = lostfound.create_animal_from_found(base.get_dbo(), "test", self.faid) animal.delete_animal(base.get_dbo(), "test", aid)
def test_create_animal(self): aid = waitinglist.create_animal(base.get_dbo(), "test", self.wlid) assert aid is not None and aid > 0 animal.delete_animal(base.get_dbo(), "test", aid)