[collector] ensure model manager retrieves newest Teil first
closes: #7
This commit is contained in:
parent
bcf6dff1b0
commit
719d4254b2
2 changed files with 13 additions and 0 deletions
|
@ -16,6 +16,7 @@ class Teil(models.Model):
|
|||
|
||||
verbose_name = "Teil"
|
||||
verbose_name_plural = "Teile"
|
||||
ordering = ["-modified"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
modified = self.modified.isoformat(timespec="seconds")
|
||||
|
|
|
@ -90,3 +90,15 @@ def test_enter_endpoints_emits_expected_logs(
|
|||
for le in logs
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_model_manager_lists_newest_teil_first():
|
||||
t1 = Teil.objects.create(name="Teil 1")
|
||||
t2 = Teil.objects.create(name="Teil 2")
|
||||
t3 = Teil.objects.create(name="Teil 3")
|
||||
|
||||
assert t1.modified < t2.modified < t3.modified
|
||||
|
||||
all_teile = Teil.objects.all()
|
||||
|
||||
assert all_teile[2].modified < all_teile[1].modified < all_teile[0].modified
|
||||
|
|
Loading…
Add table
Reference in a new issue