Exemplo n.º 1
0
 def test_select_factors_get(self):
     resp = self.client.get(reverse('tracks-select_factors'))
     self.assertEqual(resp.status_code, STATUS_OK)
     self._check_nav_context(resp)
     self.assertEqual(resp.context['step_items'],
                      Steps.make_items(Steps.TRANSCRIPTION_FACTORS))
     self.assertIsInstance(resp.context['form'], TranscriptionFactorForm)
     self.assertEqual(resp.context['form'].errors, {})
Exemplo n.º 2
0
 def test_make_items_cell_type(self):
     items = Steps.make_items(Steps.CELL_TYPES)
     self.assertEqual(items, [{
         'label': Steps.TRANSCRIPTION_FACTORS,
         'is_active': False
     }, {
         'label': Steps.CELL_TYPES,
         'is_active': True
     }])
Exemplo n.º 3
0
 def test_select_factors_post_without_data(self):
     resp = self.client.post(reverse('tracks-select_factors'))
     self.assertEqual(resp.status_code, STATUS_OK)
     self._check_nav_context(resp)
     self.assertEqual(resp.context['step_items'],
                      Steps.make_items(Steps.TRANSCRIPTION_FACTORS))
     self.assertIsInstance(resp.context['form'], TranscriptionFactorForm)
     self.assertEqual(resp.context['form'].errors,
                      {FormFields.TF_NAME: ['This field is required.']})
Exemplo n.º 4
0
 def test_select_cell_type_post_without_data(self):
     resp = self.client.post(reverse('tracks-select_cell_type'))
     self.assertEqual(resp.status_code, STATUS_OK)
     self._check_nav_context(resp)
     self.assertEqual(resp.context['step_items'],
                      Steps.make_items(Steps.CELL_TYPES))
     resp_form = resp.context['form']
     self.assertIsInstance(resp_form, CellTypeForm)
     self.assertEqual(resp_form.errors,
                      {FormFields.CELL_TYPE: ['This field is required.']})
Exemplo n.º 5
0
 def test_select_tracks_get_with_data(self):
     resp = self.client.get(
         reverse('tracks-select_tracks') +
         '?tf=AR&tf=ATF&celltype=8988T&celltype=CLL')
     self.assertEqual(resp.status_code, STATUS_OK)
     self._check_nav_context(resp)
     self.assertEqual(resp.context['step_items'],
                      Steps.make_items(Steps.TRACKS))
     tf_names = [tf.name for tf in resp.context['tfs']]
     self.assertEqual(tf_names, ['AR', 'ATF'])
     celltype_names = [
         celltype.name for celltype in resp.context['celltypes']
     ]
     self.assertEqual(celltype_names, ['8988T', 'CLL'])
Exemplo n.º 6
0
 def test_select_cell_type_get_with_data(self):
     resp = self.client.get(
         reverse('tracks-select_cell_type') + '?tf=AR&tf=ATF')
     self.assertEqual(resp.status_code, STATUS_OK)
     self._check_nav_context(resp)
     self.assertEqual(resp.context['step_items'],
                      Steps.make_items(Steps.CELL_TYPES))
     resp_form = resp.context['form']
     self.assertIsInstance(resp_form, CellTypeForm)
     self.assertEqual(resp_form.errors, {})
     tf_names = [
         tf.name for tf in resp_form.cleaned_data[FormFields.TF_NAME]
     ]
     self.assertEqual(tf_names, ['AR', 'ATF'])
Exemplo n.º 7
0
 def test_make_items_tfs(self):
     items = Steps.make_items(Steps.TRANSCRIPTION_FACTORS)
     self.assertEqual(items, [{
         'label': Steps.TRANSCRIPTION_FACTORS,
         'is_active': True
     }])