def test_sample_template_filepaths_get_req_no_access(self): obs = sample_template_filepaths_get_req(1, '*****@*****.**') exp = { 'status': 'error', 'message': 'User does not have access to study' } self.assertEqual(obs, exp)
def test_sample_template_filepaths_get_req(self): templates_dir = qdb.util.get_mountpoint('templates')[0][1] obs = sample_template_filepaths_get_req(1, '*****@*****.**') exp = {'status': 'success', 'message': '', 'filepaths': [(17, join(templates_dir, '1_19700101-000000.txt'))]} self.assertEqual(obs, exp)
def test_sample_template_filepaths_get_req(self): obs = sample_template_filepaths_get_req(1, '*****@*****.**') # have to check each key individually as the filepaths will change self.assertEqual(obs['status'], 'success') self.assertEqual(obs['message'], '') # [0] the fp_id is the first element, that should change fp_ids = [fp[0] for fp in obs['filepaths']] self.assertItemsEqual(fp_ids, [17, 22])
def test_sample_template_filepaths_get_req(self): obs = sample_template_filepaths_get_req(1, '*****@*****.**') # have to check each key individually as the filepaths will change self.assertEqual(obs['status'], 'success') self.assertEqual(obs['message'], '') # [0] the fp_id is the first element, that should change fp_ids = [fp[0] for fp in obs['filepaths']] self.assertItemsEqual(fp_ids, [17, 22])
def test_sample_template_filepaths_get_req(self): templates_dir = qdb.util.get_mountpoint('templates')[0][1] obs = sample_template_filepaths_get_req(1, '*****@*****.**') exp = { 'status': 'success', 'message': '', 'filepaths': [(17, join(templates_dir, '1_19700101-000000.txt'))] } self.assertEqual(obs, exp)
def test_sample_template_filepaths_get_req_no_template(self): obs = sample_template_filepaths_get_req(self.new_study.id, '*****@*****.**') self.assertEqual( obs, { 'status': 'error', 'message': 'Sample template %d does not ' 'exist' % self.new_study.id })
def test_sample_template_filepaths_get_req_no_template(self): obs = sample_template_filepaths_get_req(self.new_study.id, "*****@*****.**") self.assertEqual( obs, {"status": "error", "message": "Sample template %d does not " "exist" % self.new_study.id} )
def test_sample_template_filepaths_get_req_no_access(self): obs = sample_template_filepaths_get_req(1, "*****@*****.**") exp = {"status": "error", "message": "User does not have access to study"} self.assertEqual(obs, exp)
def test_sample_template_filepaths_get_req(self): templates_dir = qdb.util.get_mountpoint("templates")[0][1] obs = sample_template_filepaths_get_req(1, "*****@*****.**") exp = {"status": "success", "message": "", "filepaths": [(17, join(templates_dir, "1_19700101-000000.txt"))]} self.assertEqual(obs, exp)
def test_sample_template_filepaths_get_req_no_template(self): obs = sample_template_filepaths_get_req(self.new_study.id, '*****@*****.**') self.assertEqual(obs, {'status': 'error', 'message': 'Sample template %d does not ' 'exist' % self.new_study.id})
def test_sample_template_filepaths_get_req_no_access(self): obs = sample_template_filepaths_get_req(1, '*****@*****.**') exp = {'status': 'error', 'message': 'User does not have access to study'} self.assertEqual(obs, exp)