Changed "Historische Version..." to "Zukünftige Version..." when appropriate
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 16s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 16s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
This commit is contained in:
@@ -16,7 +16,11 @@
|
||||
|
||||
{% if standard.history == True %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{% if standard.is_future %}
|
||||
<strong>Zukünftige Version vom {{ standard.check_date }}</strong>
|
||||
{% else %}
|
||||
<strong>Historische Version vom {{ standard.check_date }}</strong>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -493,6 +493,38 @@ class ViewsTestCase(TestCase):
|
||||
url = reverse('standard_history', kwargs={'nummer': 'R01234'})
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_standard_history_past_date_shows_historische(self):
|
||||
"""Test that past dates show 'Historische Version'"""
|
||||
past_date = (date.today() - timedelta(days=30)).strftime('%Y-%m-%d')
|
||||
url = f'/dokumente/R01234/history/{past_date}/'
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Historische Version vom')
|
||||
self.assertNotContains(response, 'Zukünftige Version vom')
|
||||
# Verify is_future flag is False
|
||||
self.assertFalse(response.context['standard'].is_future)
|
||||
|
||||
def test_standard_history_future_date_shows_zukuenftige(self):
|
||||
"""Test that future dates show 'Zukünftige Version'"""
|
||||
future_date = (date.today() + timedelta(days=30)).strftime('%Y-%m-%d')
|
||||
url = f'/dokumente/R01234/history/{future_date}/'
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Zukünftige Version vom')
|
||||
self.assertNotContains(response, 'Historische Version vom')
|
||||
# Verify is_future flag is True
|
||||
self.assertTrue(response.context['standard'].is_future)
|
||||
|
||||
def test_standard_detail_current_has_no_version_label(self):
|
||||
"""Test that current view (no history) has no version label"""
|
||||
url = reverse('standard_detail', kwargs={'nummer': 'R01234'})
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertNotContains(response, 'Historische Version vom')
|
||||
self.assertNotContains(response, 'Zukünftige Version vom')
|
||||
# Verify history flag is False
|
||||
self.assertFalse(response.context['standard'].history)
|
||||
|
||||
|
||||
class URLPatternsTest(TestCase):
|
||||
|
||||
@@ -29,9 +29,11 @@ def standard_detail(request, nummer,check_date=""):
|
||||
if check_date:
|
||||
check_date = calendar.parseDT(check_date)[0].date()
|
||||
standard.history = True
|
||||
standard.is_future = check_date > date.today()
|
||||
else:
|
||||
check_date = date.today()
|
||||
standard.history = False
|
||||
standard.is_future = False
|
||||
standard.check_date=check_date
|
||||
vorgaben = list(standard.vorgaben.order_by("thema","nummer").select_related("thema","dokument")) # convert queryset to list so we can attach attributes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user