mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.19k stars 22.48k forks source link

Tests for forms aren't working as expected. #33495

Open BalaurZmeu opened 6 months ago

BalaurZmeu commented 6 months ago

MDN URL

https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Testing

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Testing#forms

What information was incorrect, unhelpful, or incomplete?

The last two tests which are testing forms are not passing.

def test_renew_form_date_today(self):
        date = datetime.date.today()
        form = RenewBookForm(data={'renewal_date': date})
        self.assertTrue(form.is_valid())

 def test_renew_form_date_max(self):
        date = timezone.localtime() + datetime.timedelta(weeks=4)
        form = RenewBookForm(data={'renewal_date': date})
        self.assertTrue(form.is_valid())

These two are failing:

FAIL: test_renew_form_date_max (catalog.tests.test_forms.RenewBookFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/zmeu/code/Mozilla_Django_Tutorial/locallibrary/catalog/tests/test_forms.py", line 33, in test_renew_form_date_max
    self.assertTrue(form.is_valid())
AssertionError: False is not true

======================================================================
FAIL: test_renew_form_date_today (catalog.tests.test_forms.RenewBookFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/zmeu/code/Mozilla_Django_Tutorial/locallibrary/catalog/tests/test_forms.py", line 28, in test_renew_form_date_today
    self.assertTrue(form.is_valid())
AssertionError: False is not true

-------------------------------------------------------------------

What did you expect to see?

I am following every instruction in the tutorial very carefully. I completed all challenges. I don't know what is wrong.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details * Folder: `en-us/learn/server-side/django/testing` * MDN URL: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Testing * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/learn/server-side/django/testing/index.md * Last commit: https://github.com/mdn/content/commit/f7f7ccaf09b65b66e0c995e6df53888288411770 * Document last modified: 2024-02-28T05:13:14.000Z
Josh-Cena commented 4 months ago

(@hamishwillee I'm just going to assign Django & Express issues to you so they are on your radar to investigate)

hamishwillee commented 4 months ago

Thanks @Josh-Cena - I'd prefer it that way :-)