Exemplo n.º 1
0
  def test_app_failed_on_stable(self):
    """Test raising AppFailedException when getting stable impact."""
    self.mock.get_impact_on_build.side_effect = impact_task.AppFailedException()
    self.mock.get_impacts_from_url.return_value = self.impacts

    self.assertEqual(
        self.impacts,
        impact_task.get_impacts_on_prod_builds(self.testcase, 'path'))
    self.mock.get_impact_on_build.assert_has_calls([
        mock.call('stable', self.testcase.impact_stable_version, self.testcase,
                  'path')
    ])
    self.mock.get_impacts_from_url.assert_has_calls(
        [mock.call(self.testcase.regression, self.testcase.job_type)])
    def test_app_failed_on_beta(self):
        """Test app fail on beta."""
        self.mock.get_impact_on_build.side_effect = [
            self.impacts.stable,
            impact_task.AppFailedException()
        ]

        self.assertEqual(
            impact_task.Impacts(self.impacts.stable, impact_task.Impact()),
            impact_task.get_impacts_on_prod_builds(self.testcase, 'path'))
        self.mock.get_impact_on_build.assert_has_calls([
            mock.call('stable', self.testcase.impact_stable_version,
                      self.testcase, 'path'),
            mock.call('beta', self.testcase.impact_beta_version, self.testcase,
                      'path'),
        ])
        self.mock.get_impacts_from_url.assert_has_calls([])