コード例 #1
0
    def test_form_saves_results(self):
        created_experiment = ExperimentFactory.create_with_status(
            Experiment.STATUS_COMPLETE, results_early_end=False)
        self.assertEqual(created_experiment.changes.count(), 6)

        data = self.valid_data.copy()
        form = ExperimentResultsForm(request=self.request,
                                     data=data,
                                     instance=created_experiment)

        self.assertTrue(form.is_valid())

        experiment = form.save()

        self.assertEqual(experiment.results_url, "https://example.com")
        self.assertEqual(experiment.results_initial,
                         "Initially, all went well.")
        self.assertFalse(experiment.results_fail_to_launch)
        self.assertTrue(experiment.results_recipe_errors)
        self.assertTrue(experiment.results_restarts)
        self.assertFalse(experiment.results_low_enrollment)
        self.assertTrue(experiment.results_early_end)
        self.assertFalse(experiment.results_no_usable_data)
        self.assertEqual(experiment.results_failures_notes, "Bad.")
        self.assertTrue(experiment.results_changes_to_firefox)
        self.assertFalse(experiment.results_data_for_hypothesis)
        self.assertTrue(experiment.results_confidence)
        self.assertFalse(experiment.results_measure_impact)
        self.assertEqual(experiment.results_impact_notes, "Good.")
        self.assertEqual(experiment.changes.count(), 7)
コード例 #2
0
    def test_form_saves_results(self):
        created_experiment = ExperimentFactory.create_with_status(
            Experiment.STATUS_COMPLETE)
        self.assertEqual(created_experiment.changes.count(), 6)

        data = self.valid_data.copy()
        form = ExperimentResultsForm(request=self.request,
                                     data=data,
                                     instance=created_experiment)

        self.assertTrue(form.is_valid())

        experiment = form.save()

        self.assertEqual(experiment.results_url, "https://example.com")
        self.assertEqual(experiment.results_initial,
                         "Initially, all went well.")
        self.assertTrue(experiment.results_recipe_errors)
        self.assertTrue(experiment.results_confidence)
        self.assertEqual(experiment.results_failures_notes, "Bad.")
        self.assertEqual(experiment.changes.count(), 7)
コード例 #3
0
 def test_no_fields_required(self):
     experiment = ExperimentFactory.create()
     form = ExperimentResultsForm(request=self.request,
                                  data={},
                                  instance=experiment)
     self.assertTrue(form.is_valid())