feat: Add Adults and Juniors dashboards with concise layout, totals, tooltips and unified navigation
Co-authored-by: Antigravity <antigravity@google.com>
This commit is contained in:
@@ -130,5 +130,65 @@ class TestWebApp(unittest.TestCase):
|
||||
self.assertIn(b'OK', response.data)
|
||||
self.assertIn(b'?', response.data)
|
||||
|
||||
@patch('app.get_cached_data', side_effect=_bypass_cache)
|
||||
@patch('app.fetch_sheet_data')
|
||||
@patch('app.fetch_exceptions', return_value={})
|
||||
@patch('app.get_members_with_fees')
|
||||
def test_adults_route(self, mock_get_members, mock_exceptions, mock_fetch_sheet, mock_cache):
|
||||
"""Test that /adults returns 200 and shows combined matches"""
|
||||
mock_get_members.return_value = (
|
||||
[('Test Member', 'A', {'2026-01': (750, 4)})],
|
||||
['2026-01']
|
||||
)
|
||||
mock_fetch_sheet.return_value = [{
|
||||
'date': '2026-01-01',
|
||||
'amount': 750,
|
||||
'person': 'Test Member',
|
||||
'purpose': '2026-01',
|
||||
'message': 'test payment',
|
||||
'sender': 'External Bank User',
|
||||
'inferred_amount': 750
|
||||
}]
|
||||
|
||||
response = self.client.get('/adults')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b'Adults Dashboard', response.data)
|
||||
self.assertIn(b'Test Member', response.data)
|
||||
self.assertNotIn(b'OK', response.data)
|
||||
self.assertIn(b'750/750 CZK (4)', response.data)
|
||||
|
||||
@patch('app.get_cached_data', side_effect=_bypass_cache)
|
||||
@patch('app.fetch_sheet_data')
|
||||
@patch('app.fetch_exceptions', return_value={})
|
||||
@patch('app.get_junior_members_with_fees')
|
||||
def test_juniors_route(self, mock_get_junior_members, mock_exceptions, mock_fetch_sheet, mock_cache):
|
||||
"""Test that /juniors returns 200, uses single line format, and displays '?' properly"""
|
||||
mock_get_junior_members.return_value = (
|
||||
[
|
||||
('Junior One', 'J', {'2026-01': (500, 3, 0, 3)}),
|
||||
('Junior Two', 'X', {'2026-01': ('?', 1, 0, 1)})
|
||||
],
|
||||
['2026-01']
|
||||
)
|
||||
mock_exceptions.return_value = {}
|
||||
mock_fetch_sheet.return_value = [{
|
||||
'date': '2026-01-15',
|
||||
'amount': 500,
|
||||
'person': 'Junior One',
|
||||
'purpose': '2026-01',
|
||||
'message': '',
|
||||
'sender': 'Parent',
|
||||
'inferred_amount': 500
|
||||
}]
|
||||
|
||||
response = self.client.get('/juniors')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b'Juniors Dashboard', response.data)
|
||||
self.assertIn(b'Junior One', response.data)
|
||||
self.assertIn(b'Junior Two', response.data)
|
||||
self.assertNotIn(b'OK', response.data)
|
||||
self.assertIn(b'500/500 CZK', response.data)
|
||||
self.assertIn(b'?', response.data)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user