def test_check_with_rapid_review_and_bugzilla_and_no_kinto_pending_pushes_experiment( self, ): experiment = ExperimentFactory.create_with_status( Experiment.STATUS_REVIEW, bugzilla_id="12345", firefox_channel=Experiment.CHANNEL_RELEASE, firefox_max_version=None, firefox_min_version=Experiment.VERSION_CHOICES[0][0], name="test", type=Experiment.TYPE_RAPID, ) self.assertEqual(experiment.changes.count(), 2) self.setup_kinto_no_pending_review() tasks.check_kinto_push_queue() self.mock_push_task.assert_called_with(experiment.id) experiment = Experiment.objects.get(id=experiment.id) self.assertEqual(experiment.changes.count(), 3) self.assertEqual(experiment.status, Experiment.STATUS_ACCEPTED) self.assertEqual(experiment.firefox_min_version, Experiment.VERSION_CHOICES[0][0]) self.assertEqual(experiment.firefox_channel, Experiment.CHANNEL_RELEASE) self.assertEqual(experiment.recipe_slug, "bug-12345-rapid-test-release-55")
def test_check_with_rapid_review_and_kinto_pending_pushes_nothing(self): ExperimentFactory.create( type=Experiment.TYPE_RAPID, status=Experiment.STATUS_REVIEW, ) self.setup_kinto_pending_review() tasks.check_kinto_push_queue() self.mock_push_task.assert_not_called()
def test_check_with_no_review_status_pushes_nothing(self): for status in [ Experiment.STATUS_DRAFT, Experiment.STATUS_ACCEPTED, Experiment.STATUS_LIVE, Experiment.STATUS_COMPLETE, ]: ExperimentFactory.create(type=Experiment.TYPE_RAPID, status=status) self.setup_kinto_no_pending_review() tasks.check_kinto_push_queue() self.mock_push_task.assert_not_called()
def test_check_with_rapid_review_and_no_bugzilla_and_no_kinto_pending_pushes_nothing( self, ): ExperimentFactory.create_with_status( Experiment.STATUS_REVIEW, bugzilla_id=None, firefox_channel=Experiment.CHANNEL_RELEASE, firefox_max_version=None, firefox_min_version=Experiment.VERSION_CHOICES[0][0], name="test", type=Experiment.TYPE_RAPID, ) self.setup_kinto_no_pending_review() tasks.check_kinto_push_queue() self.mock_push_task.assert_not_called()
def test_check_with_reject_rapid_review(self): experiment = ExperimentFactory.create_with_status( Experiment.STATUS_ACCEPTED, bugzilla_id="12345", firefox_channel=Experiment.CHANNEL_RELEASE, firefox_max_version=None, firefox_min_version=Experiment.VERSION_CHOICES[0][0], name="test", type=Experiment.TYPE_RAPID, recipe_slug="bug-12345-rapid-test-release-55", ) self.mock_kinto_client.delete_record.return_value = {} self.mock_kinto_client.get_collection.side_effect = [ { "data": { "status": KINTO_REJECTED_STATUS, "last_reviewer_comment": "it's no good", } }, { "data": { "status": "anything" } }, ] self.mock_kinto_client.get_records.side_effect = [ [{ "id": "bug-9999-rapid-test-release-55" }], [ { "id": "bug-12345-rapid-test-release-55" }, { "id": "bug-9999-rapid-test-release-55" }, ], ] tasks.check_kinto_push_queue() self.mock_kinto_client.delete_record.assert_called() self.assertTrue( experiment.changes.filter( changed_by__email=settings.KINTO_DEFAULT_CHANGELOG_USER, old_status=Experiment.STATUS_ACCEPTED, new_status=Experiment.STATUS_REJECTED, ).exists())
def test_check_with_empty_queue_pushes_nothing(self): self.setup_kinto_no_pending_review() tasks.check_kinto_push_queue() self.mock_push_task.assert_not_called()