-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/1647-banner
- Loading branch information
Showing
40 changed files
with
509 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/open_inwoner/components/templates/components/Form/Label.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from django.test import TestCase | ||
|
||
from pyquery import PyQuery | ||
|
||
from open_inwoner.accounts.tests.factories import UserFactory | ||
from open_inwoner.cms.products.cms_apps import ProductsApphook | ||
from open_inwoner.cms.tests import cms_tools | ||
from open_inwoner.cms.tests.cms_tools import create_apphook_page | ||
from open_inwoner.configurations.models import SiteConfiguration | ||
from open_inwoner.pdc.tests.factories import CategoryFactory | ||
|
||
|
||
class HeaderTest(TestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.user = UserFactory() | ||
cls.user.set_password("12345") | ||
cls.user.email = "[email protected]" | ||
cls.user.save() | ||
|
||
cms_tools.create_homepage() | ||
|
||
# PrimaryNavigation.html requires apphook + categories | ||
create_apphook_page(ProductsApphook) | ||
cls.published1 = CategoryFactory( | ||
path="0001", name="First one", slug="first-one" | ||
) | ||
cls.published2 = CategoryFactory( | ||
path="0002", name="Second one", slug="second-one" | ||
) | ||
|
||
def test_categories_hidden_from_anonymous_users(self): | ||
config = SiteConfiguration.get_solo() | ||
config.hide_categories_from_anonymous_users = True | ||
config.save() | ||
|
||
response = self.client.get("/") | ||
|
||
doc = PyQuery(response.content) | ||
|
||
categories = doc.find("[title='Onderwerpen']") | ||
self.assertEqual(len(categories), 0) | ||
|
||
def test_categories_not_hidden_from_anonymous_users(self): | ||
config = SiteConfiguration.get_solo() | ||
config.hide_categories_from_anonymous_users = False | ||
config.save() | ||
|
||
response = self.client.get("/") | ||
|
||
doc = PyQuery(response.content) | ||
|
||
categories = doc.find("[title='Onderwerpen']") | ||
self.assertEqual(len(categories), 2) | ||
self.assertEqual(categories[0].tag, "a") | ||
self.assertEqual(categories[1].tag, "button") | ||
|
||
def test_search_bar_hidden_from_anonymous_users(self): | ||
config = SiteConfiguration.get_solo() | ||
config.hide_search_from_anonymous_users = True | ||
config.save() | ||
|
||
response = self.client.get("/") | ||
|
||
doc = PyQuery(response.content) | ||
|
||
search_buttons = doc.find("[title='Zoeken']") | ||
|
||
self.assertEqual(len(search_buttons), 0) | ||
|
||
def test_search_bar_not_hidden_from_anonymous_users(self): | ||
config = SiteConfiguration.get_solo() | ||
config.hide_search_from_anonymous_users = False | ||
config.save() | ||
|
||
response = self.client.get("/") | ||
|
||
doc = PyQuery(response.content) | ||
|
||
search_buttons = doc.find("[title='Zoeken']") | ||
|
||
for button in search_buttons: | ||
self.assertEqual(button.tag, "button") |
Oops, something went wrong.