Esempio n. 1
0
 def test_format_bug_body_lists_countries_locales(self):
     country = CountryFactory(code="CA", name="Canada")
     locale = LocaleFactory(code="da", name="Danish")
     experiment = ExperimentFactory.create(countries=[country],
                                           locales=[locale])
     body = format_bug_body(experiment)
     self.assertIn("Countries: Canada (CA)", body)
     self.assertIn("Locales: Danish (da)", body)
Esempio n. 2
0
 def test_adds_bugzilla_comment_when_review_becomes_ready_to_ship(self):
     experiment = ExperimentFactory.create_with_status(
         Experiment.STATUS_REVIEW, bugzilla_id="123")
     form = ExperimentStatusForm(
         request=self.request,
         data={"status": experiment.STATUS_SHIP},
         instance=experiment,
     )
     self.assertTrue(form.is_valid())
     experiment = form.save()
     self.mock_bugzilla_requests_post.assert_called_with(
         settings.BUGZILLA_COMMENT_URL.format(id=experiment.bugzilla_id),
         {"comment": format_bug_body(experiment)},
     )
Esempio n. 3
0
 def test_adds_bugzilla_comment_when_review_phd_is_set(self):
     experiment = ExperimentFactory.create_with_status(
         Experiment.STATUS_REVIEW, bugzilla_id="123", review_phd=False)
     form = ExperimentReviewForm(
         request=self.request,
         data={"review_phd": True},
         instance=experiment,
     )
     self.assertTrue(form.is_valid())
     experiment = form.save()
     self.mock_bugzilla_requests_post.assert_called_with(
         settings.BUGZILLA_COMMENT_URL.format(id=experiment.bugzilla_id),
         {"comment": format_bug_body(experiment)},
     )
Esempio n. 4
0
    def test_add_bugzilla_comment_pref_experiment(self):
        experiment = ExperimentFactory.create_with_status(
            Experiment.STATUS_DRAFT,
            name="An Experiment",
            bugzilla_id="123",
            type=Experiment.TYPE_PREF,
        )

        comment_id = add_experiment_comment(experiment)

        self.assertEqual(comment_id, self.bugzilla_id)

        self.mock_bugzilla_requests_post.assert_called_with(
            settings.BUGZILLA_COMMENT_URL.format(id=experiment.bugzilla_id),
            {"comment": format_bug_body(experiment)},
        )
Esempio n. 5
0
    def test_update_bugzilla_addon_experiment(self):
        experiment = ExperimentFactory.create_with_status(
            Experiment.STATUS_DRAFT,
            name="An Experiment",
            bugzilla_id="123",
            type=Experiment.TYPE_ADDON,
            firefox_min_version="56.0",
            firefox_max_version="",
            firefox_channel="Nightly",
        )
        update_experiment_bug(experiment)
        summary = "[Experiment] Add-On: An Experiment Fx 56.0 Nightly"

        self.mock_bugzilla_requests_put.assert_called_with(
            settings.BUGZILLA_UPDATE_URL.format(id=experiment.bugzilla_id),
            {"summary": summary, "cf_user_story": format_bug_body(experiment)},
        )
Esempio n. 6
0
    def test_update_bugzilla_pref_experiment(self):
        experiment = ExperimentFactory.create_with_status(
            Experiment.STATUS_DRAFT,
            name="An Experiment",
            bugzilla_id="123",
            type=Experiment.TYPE_PREF,
            firefox_min_version="55.0",
            firefox_max_version="56.0",
            firefox_channel="Beta",
        )

        update_experiment_bug(experiment)
        summary = "[Experiment] Pref-Flip: An Experiment Fx 55.0 to 56.0 Beta"

        self.mock_bugzilla_requests_put.assert_called_with(
            settings.BUGZILLA_UPDATE_URL.format(id=experiment.bugzilla_id),
            {"summary": summary, "cf_user_story": format_bug_body(experiment)},
        )
Esempio n. 7
0
 def test_countries_locales_list_all_when_none_specified(self):
     experiment = ExperimentFactory.create(countries=[], locales=[])
     body = format_bug_body(experiment)
     self.assertIn("Countries: all", body)
     self.assertIn("Locales: all", body)