def test_create_control_sample_type(self): SampleComposition.create_control_sample_type('testing.control', 'A test') obs = SampleComposition.get_control_sample_types_description() exp = [{ 'external_id': 'blank', 'description': 'gDNA extraction blanks. Represents an empty ' 'extraction well.' }, { 'external_id': 'empty', 'description': 'Empty well. Represents an empty well that should ' 'not be included in library preparation.' }, { 'external_id': 'testing.control', 'description': 'A test' }, { 'external_id': 'vibrio.positive.control', 'description': 'Bacterial isolate control (Vibrio fischeri ES114)' '. Represents an extraction well loaded with ' 'Vibrio.' }, { 'external_id': 'zymo.mock', 'description': 'Bacterial community control (Zymo Mock D6306). ' 'Represents an extraction well loaded with Zymo ' 'Mock community.' }] self.assertEqual(obs, exp)
def plate_map_handler_get_request(process_id): plate_id = None if process_id is not None: try: process = SamplePlatingProcess(process_id) except LabControlUnknownIdError: raise HTTPError(404, reason="Plating process %s doesn't exist" % process_id) plate_id = process.plate.id plate_confs = [[pc.id, pc.description, pc.num_rows, pc.num_columns] for pc in PlateConfiguration.iter() if 'plate map' not in pc.description] cdesc = SampleComposition.get_control_sample_types_description() return { 'plate_confs': plate_confs, 'plate_id': plate_id, 'process_id': process_id, 'controls_description': cdesc }
def test_post_manage_controls_handler(self): response = self.post('/sample/manage_controls', { 'external_id': 'zzTestControl', 'description': 'A test control' }) self.assertEqual(response.code, 200) obs = SampleComposition.get_control_sample_types_description() exp = [{ 'external_id': 'blank', 'description': 'gDNA extraction blanks. Represents an empty ' 'extraction well.' }, { 'external_id': 'empty', 'description': 'Empty well. Represents an empty well that should ' 'not be included in library preparation.' }, { 'external_id': 'vibrio.positive.control', 'description': 'Bacterial isolate control (Vibrio fischeri ES114)' '. Represents an extraction well loaded with ' 'Vibrio.' }, { 'external_id': 'zymo.mock', 'description': 'Bacterial community control (Zymo Mock D6306). ' 'Represents an extraction well loaded with Zymo ' 'Mock community.' }, { 'external_id': 'zzTestControl', 'description': 'A test control' }] self.assertEqual(obs, exp)
def get(self): controls = SampleComposition.get_control_sample_types_description() self.render('controls.html', controls=controls)