예제 #1
0
def test_get_period():
    """Let's make sure we can get the right number of days."""
    yesterday = (datetime.date.today() - datetime.timedelta(1)).strftime(
            '%Y-%m-%d')
    f = forms.ReporterSearchForm(dict(date_start=yesterday))
    assert f.is_valid()
    eq_(views.get_period(f), ('1d', 1))
예제 #2
0
def test_forms_product_chooser():
    """We should assume firefox by default in our forms."""
    f = forms.ReporterSearchForm(dict(product='dasdsad'))
    eq_(f.fields['product'].initial, 'firefox')
    f = forms.ReporterSearchForm(dict(product='mobile'))
    eq_(f.fields['product'].initial, 'mobile')