Пример #1
0
 def test_make_new_survey(self):
     survey = NewTranscriptionSurveyForm({
         'name': 'seed generation transcription survey',
         'game': self.game.pk,
         'generation': 0,
         'num_transcriptions_per_taker': 5,
     })
     self.assertTrue(survey.is_valid())
Пример #2
0
    def test_make_survey_from_message_ids(self):
        chain = mommy.make(Chain, game=self.game)
        mommy.make(Message, chain=chain, _quantity=2)
        message_ids = Message.objects.filter(chain=chain.id).values_list('id', flat=True)

        survey = NewTranscriptionSurveyForm({
            'name': 'make survey from message ids',
            'messages': ','.join(map(str, list(message_ids))),
            'num_transcriptions_per_taker': 5,
        })
        self.assertTrue(survey.is_valid())
    def test_take_transcription_survey(self):
        """Transcribe a single message.

        Requires a transcription survey to be made.
        """
        survey_name = 'test take a transcription survey'
        ids_in_hand = Message.objects.values_list('id', flat=True)
        form = NewTranscriptionSurveyForm({
            'name': survey_name,
            'messages': ','.join(map(str, ids_in_hand)),
            'num_transcriptions_per_taker': 2,
        })
        form.save()

        self.browser.get(self.live_server_url)
        self.browser.find_element_by_id('id_transcriptions_list').click()
Пример #4
0
    def test_catch_trial_id_gets_attached_to_survey(self):
        chain = mommy.make(Chain, game=self.game)
        mommy.make(Message, chain=chain, _quantity=2)
        message_ids = Message.objects.filter(chain=chain.id).values_list('id', flat=True)

        catch_trial_message = unipath.Path(
            settings.APP_DIR, 'transcribe/tests/media/catch_trial.wav'
        )
        catch_trial = File(open(catch_trial_message, 'rb'))

        post_data = {
            'name': 'make survey from message ids',
            'messages': ','.join(map(str, list(message_ids))),
            'num_transcriptions_per_taker': 5,
        }
        files_data = {'catch_trial': catch_trial}
        survey = NewTranscriptionSurveyForm(post_data, files_data)
        self.assertTrue(survey.is_valid())

        survey = survey.save()
        self.assertIsNotNone(survey.catch_trial_id)