Skip to content

Commit

Permalink
Added test for change with date range filter
Browse files Browse the repository at this point in the history
  • Loading branch information
harriebird committed Jun 19, 2024
1 parent 9e4f00d commit faf1e28
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions weblate/trans/tests/test_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

"""Tests for changes browsing."""

from datetime import timedelta

from django.urls import reverse
from django.utils import timezone

from weblate.trans.models import Unit
from weblate.trans.tests.test_views import ViewTestCase
Expand Down Expand Up @@ -57,3 +60,10 @@ def test_user(self) -> None:
response = self.client.get(reverse("changes"), {"user": self.user.username})
self.assertContains(response, "Translation added")
self.assertNotContains(response, "Invalid search string!")

def test_daterange(self) -> None:
end = timezone.now()
start = end - timedelta(days=1)
period = "{} - {}".format(start.strftime("%m/%d/%Y"), end.strftime("%m/%d/%Y"))
response = self.client.get(reverse("changes"), {"period": period})
self.assertContains(response, "Resource update")

0 comments on commit faf1e28

Please sign in to comment.