Esempio n. 1
0
    def test_get_choice_with_kwargs(self):
        """Testing ConditionChoices.get_choice with kwargs for extra state"""
        class MyChoice1(BaseConditionChoice):
            choice_id = 'my-choice-1'

        choices = ConditionChoices([MyChoice1])
        choice = choices.get_choice('my-choice-1', choice_kwargs={'abc': 123})
        self.assertEqual(choice.extra_state, {'abc': 123})
Esempio n. 2
0
    def test_get_choice(self):
        """Testing ConditionChoices.get_choice"""
        class MyChoice1(BaseConditionChoice):
            choice_id = 'my-choice-1'

        choices = ConditionChoices([MyChoice1])
        self.assertEqual(choices.get_choice('my-choice-1').__class__,
                         MyChoice1)
Esempio n. 3
0
    def test_get_choice_with_invalid_id(self):
        """Testing ConditionChoices.get_choice with invalid ID"""
        choices = ConditionChoices()

        with self.assertRaises(ConditionChoiceNotFoundError):
            choices.get_choice('invalid')