Exemplo n.º 1
0
def test_site_settings_form(site_settings):
    data = {'header_text': 'mirumee', 'description': 'mirumee.com'}
    form = SiteSettingsForm(data, instance=site_settings)
    assert form.is_valid()

    site = form.save()
    assert site.header_text == 'mirumee'
    assert smart_text(site) == 'mirumee.com'

    form = SiteSettingsForm({})
    assert form.is_valid()
Exemplo n.º 2
0
def test_site_settings_default_sender_name_cannot_have_newlines(
    site_settings_form_data, sender_name, sender_address, expected_errors
):
    data = site_settings_form_data
    data.update(
        {
            "default_mail_sender_name": sender_name,
            "default_mail_sender_address": sender_address,
        }
    )
    form = SiteSettingsForm(data)
    assert not form.is_valid()
    assert form.errors == expected_errors
Exemplo n.º 3
0
def test_site_settings_form(site_settings):
    data = {
        "header_text": "mirumee",
        "description": "mirumee.com",
        "default_weight_unit": "lb",
    }
    form = SiteSettingsForm(data, instance=site_settings)
    assert form.is_valid()

    site = form.save()
    assert site.header_text == "mirumee"
    assert smart_text(site) == "mirumee.com"
    assert site.default_weight_unit == "lb"

    form = SiteSettingsForm({"default_weight_unit": "lb"})
    assert form.is_valid()
Exemplo n.º 4
0
def test_site_settings_form(site_settings):
    data = {'header_text': 'mirumee', 'description': 'mirumee.com'}
    form = SiteSettingsForm(data, instance=site_settings)
    assert form.is_valid()

    site = form.save()
    assert site.header_text == 'mirumee'
    assert smart_text(site) == 'mirumee.com'

    form = SiteSettingsForm({})
    assert form.is_valid()
Exemplo n.º 5
0
def test_site_settings_form(site_settings, site_settings_form_data):
    data = site_settings_form_data
    form = SiteSettingsForm(data, instance=site_settings)
    assert form.is_valid()

    site = form.save()
    assert site.header_text == "mirumee"
    assert smart_text(site) == "mirumee.com"
    assert site.default_weight_unit == "lb"

    form = SiteSettingsForm({"default_weight_unit": "lb"})
    assert form.is_valid()