mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 13:01:50 +02:00
Add a test to check that participants are ordered consistently in statistics page
This commit is contained in:
parent
99fd1785e5
commit
b7577f1b7d
1 changed files with 15 additions and 0 deletions
|
@ -4,6 +4,7 @@ import datetime
|
|||
import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from time import sleep
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
@ -953,6 +954,20 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
response.data.decode("utf-8"), regex.format("pépé", "0.00", "0.00"),
|
||||
)
|
||||
|
||||
# Check that the order of participants in the sidebar table is the
|
||||
# same as in the main table.
|
||||
order = ["fred", "pépé", "tata", "zorglub"]
|
||||
regex1 = r".*".join(
|
||||
r"<td class=\"balance-name\">{}</td>".format(name) for name in order
|
||||
)
|
||||
regex2 = r".*".join(
|
||||
r"<td class=\"d-md-none\">{}</td>".format(name) for name in order
|
||||
)
|
||||
# Build the regexp ourselves to be able to pass the DOTALL flag
|
||||
# (so that ".*" matches newlines)
|
||||
self.assertRegex(response.data.decode("utf-8"), re.compile(regex1, re.DOTALL))
|
||||
self.assertRegex(response.data.decode("utf-8"), re.compile(regex2, re.DOTALL))
|
||||
|
||||
def test_settle_page(self):
|
||||
self.post_project("raclette")
|
||||
response = self.client.get("/raclette/settle_bills")
|
||||
|
|
Loading…
Reference in a new issue