[COM] Make the news visible for non-authenticated user and birthday visible for subriber only

This commit is contained in:
Cyl
2019-08-16 16:59:13 +02:00
parent 38ef13d9b6
commit 9e0c4e70d4
9 changed files with 112 additions and 94 deletions

View File

@ -26,6 +26,9 @@ from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.management import call_command
from django.utils import html
from django.utils.translation import ugettext as _
from core.models import User, RealGroup
@ -74,3 +77,23 @@ class ComTest(TestCase):
"""<div id="info_box">\\n <div class="markdown"><h3>INFO: <strong>Caaaataaaapuuuulte!!!!</strong></h3>"""
in str(r.content)
)
def test_birthday_non_subscribed_user(self):
self.client.login(username="guy", password="plop")
response = self.client.get(reverse("core:index"))
self.assertContains(
response,
text=html.escape(
_("You need an up to date subscription to access this content")
),
)
def test_birthday_subscibed_user(self):
response = self.client.get(reverse("core:index"))
self.assertNotContains(
response,
text=html.escape(
_("You need an up to date subscription to access this content")
),
)