def test_is_field_to_many_for_normal_field(self, monkeypatch): """Tests that test_is_field_to_many() returns False for a normal field.""" instance = Mock() model = Mock() mock_field_info = Mock(relations={}) monkeypatch.setattr( validate_utils, '_get_model_field_info', Mock(return_value=mock_field_info), ) data_combiner = DataCombiner(instance, None, model=model) assert not data_combiner.is_field_to_many('field1')
def test_is_field_to_many_for_to_many_field(self, monkeypatch): """Tests that test_is_field_to_many() returns True for a to-many field.""" instance = Mock() model = Mock() mock_field_info = Mock( relations={ 'field1': Mock(to_many=True), }, ) monkeypatch.setattr( validate_utils, '_get_model_field_info', Mock(return_value=mock_field_info), ) data_combiner = DataCombiner(instance, None, model=model) assert data_combiner.is_field_to_many('field1')