def test_convert(self, mock_find): exp = Experiment("test", ["no", "yes"], winner=None) exp.convert = Mock(return_value=Alternative("yes", exp)) mock_find.return_value = exp alternative = convert("test", "id1") self.assertEqual("yes", alternative.name) self.assertEqual("test", alternative.experiment.name)
def test_convert_with_kpi(self, mock_find): exp = Experiment("test", ["no", "yes"], winner=None) exp.convert = Mock(return_value=Alternative("yes", exp)) mock_find.return_value = exp alternative = convert("test", "id1", kpi="goal1") # TODO: we're not really asserting anything about the KPI self.assertEqual("yes", alternative.name) self.assertEqual("test", alternative.experiment.name)