Esempio n. 1
0
def test_hide_field_in_variant_choice_field_form():
    form = VariantChoiceField(Mock)
    variants, cart = MagicMock(), MagicMock()
    variants.count.return_value = 1
    variants.all()[0].pk = 'test'
    form.update_field_data(variants, cart)
    assert isinstance(form.widget, HiddenInput)
    assert form.widget.attrs.get('value') == 'test'
Esempio n. 2
0
def test_hide_field_in_variant_choice_field_form():
    form = VariantChoiceField(Mock)
    variants, cart = MagicMock(), MagicMock()
    variants.count.return_value = 1
    variants.all()[0].pk = 'test'
    form.update_field_data(variants, cart)
    assert isinstance(form.widget, HiddenInput)
    assert form.widget.attrs.get('value') == 'test'
Esempio n. 3
0
def test_hide_field_in_variant_choice_field_form():
    form = VariantChoiceField(Mock())
    variants = MagicMock()
    variants.count.return_value = variants.all().count.return_value = 1
    variants.all()[0].pk = "test"

    form.update_field_data(variants, discounts=None, country=None)

    assert isinstance(form.widget, HiddenInput)
    assert form.widget.attrs.get("value") == "test"
Esempio n. 4
0
def test_hide_field_in_variant_choice_field_form():
    form = VariantChoiceField(Mock())
    variants = MagicMock()
    variants.count.return_value = variants.all().count.return_value = 1
    variants.all()[0].pk = "test"

    form.update_field_data(variants, discounts=None, taxes=None)

    assert isinstance(form.widget, HiddenInput)
    assert form.widget.attrs.get("value") == "test"