Commit 43dc5984 authored by Ryan Herbert's avatar Ryan Herbert

tests update tests to match new file/set controllers

parent 00a5f409
Pipeline #19852 failed with stages
in 48 seconds
......@@ -77,7 +77,7 @@ class FileController(unittest.TestCase):
request.vars['filename'] = "plopapi"
request.vars["sample_type"] = defs.SET_TYPE_PATIENT
resp = add_form()
resp = submit()
self.assertNotEqual(resp.find('"redirect":"sample_set/index"'), -1, "add_form() failed")
......@@ -85,7 +85,7 @@ class FileController(unittest.TestCase):
request.vars['patient_id'] = fake_patient_id
request.vars['id'] = fake_file_id
resp = edit()
resp = form()
self.assertTrue(resp.has_key('message'), "edit() has returned an incomplete response")
......@@ -105,7 +105,7 @@ class FileController(unittest.TestCase):
request.vars["sample_type"] = defs.SET_TYPE_PATIENT
resp = edit_form()
resp = submit()
self.assertEqual(resp.find('"message":"plopapi: metadata saved"'), -1, "edit_form() failed")
......
......@@ -37,43 +37,6 @@ class PatientController(unittest.TestCase):
auth.add_permission(group_id, 'read', db.patient, 0)
auth.add_permission(group_id, 'create', db.patient, 0)
def testAdd(self):
resp = add()
self.assertTrue(resp.has_key('message'), "add() has returned an incomplete response")
def test1AddForm(self):
request.vars["first_name"] = "bob"
request.vars["last_name"] = "bob"
request.vars["birth"] = "2011-11-11"
request.vars["info"] = "test patient kZtYnOipmAzZ"
request.vars["id_label"] = "bob"
request.vars["patient_group"] = fake_group_id
name = "%s %s" % (request.vars["first_name"], request.vars["last_name"])
resp = add_form()
self.assertNotEqual(resp.find('patient %s added' % name), -1, "add patient failled")
def testEdit(self):
request.vars["id"] = fake_patient_id
resp = edit()
self.assertTrue(resp.has_key('message'), "edit() has returned an incomplete response")
def testEditForm(self):
request.vars["id"] = fake_patient_id
request.vars["first_name"] = "bab"
request.vars["last_name"] = "bab"
request.vars["birth"] = "2010-10-10"
request.vars["info"] = "bab"
request.vars["id_label"] = "bab"
resp = edit_form()
self.assertNotEqual(resp.find('bab bab (1): patient edited"'), -1, "edit patient failed")
def testConfirm(self):
......
......@@ -71,3 +71,46 @@ class Sample_setController(unittest.TestCase):
resp = change_permission()
self.assertTrue(auth.get_group_access('patient', patient.id, fake_group_id), "fail to add permission")
def testForm(self):
resp = form()
self.assertTrue(resp.has_key('message'), "add() has returned an incomplete response")
def test1Add(self):
patient = {
"first_name" : "bob",
"last_name" : "bob",
"birth" : "2011-11-11",
"info" : "test patient kZtYnOipmAzZ",
"id_label" : "bob"
}
data = {'patient':[patient], 'group': fake_group_id}
request.vars['data'] = data
name = "%s %s" % (request.vars["first_name"], request.vars["last_name"])
resp = submit()
self.assertNotEqual(resp.find('patient %s added' % name), -1, "add patient failled")
def testEdit(self):
request.vars["id"] = fake_patient_id
resp = form()
self.assertTrue(resp.has_key('message'), "edit() has returned an incomplete response")
def testEditForm(self):
patient = {
"id" : fake_patient_id,
"first_name" : "bab",
"last_name" : "bab",
"birth" : "2010-10-10",
"info" : "bab",
"id_label" : "bab"
}
data = {'patient': [patient]}
request.vars['data'] = data
resp = submit()
self.assertNotEqual(resp.find('bab bab (1): patient edited"'), -1, "edit patient failed")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment