def test_serialize_without_value_field(self):
        """Testing Condition.serialize without a value_field"""
        class MyChoice(BaseConditionChoice):
            choice_id = 'my-choice'
            operators = ConditionOperators([BasicTestOperator])

        choice = MyChoice()
        condition = Condition(choice, choice.get_operator('basic-test-op'))

        self.assertEqual(
            condition.serialize(),
            {
                'choice': 'my-choice',
                'op': 'basic-test-op',
            })
    def test_serialize(self):
        """Testing Condition.serialize"""
        class MyChoice(BaseConditionChoice):
            choice_id = 'my-choice'
            operators = ConditionOperators([BasicTestOperator])
            default_value_field = ConditionValueFormField(forms.IntegerField())

        choice = MyChoice()
        condition = Condition(choice, choice.get_operator('basic-test-op'),
                              123)

        self.assertEqual(
            condition.serialize(),
            {
                'choice': 'my-choice',
                'op': 'basic-test-op',
                'value': 123,
            })