Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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])
Пример #4
0
 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])
Пример #5
0
 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)
Пример #6
0
 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
         })
Пример #7
0
 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}
     )
Пример #8
0
 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)
Пример #9
0
 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)
Пример #10
0
 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})
Пример #11
0
 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)