aa-bulletin-board 1.10.0__py3-none-any.whl → 1.11.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_bulletin_board/__init__.py +5 -2
- aa_bulletin_board/apps.py +3 -1
- aa_bulletin_board/auth_hooks.py +15 -8
- aa_bulletin_board/docs/screenshots/weblate/.gitkeep +0 -0
- aa_bulletin_board/docs/screenshots/weblate/aa-bulletin-board-bulletin-created-message.jpg +0 -0
- aa_bulletin_board/docs/screenshots/weblate/aa-bulletin-board-group-restrictions.jpg +0 -0
- aa_bulletin_board/docs/screenshots/weblate/aa-bulletin-board-headline.jpg +0 -0
- aa_bulletin_board/docs/screenshots/weblate/aa-bulletin-board-hint-group-restrictions.jpg +0 -0
- aa_bulletin_board/docs/screenshots/weblate/aa-bulletin-board-menu-item.jpg +0 -0
- aa_bulletin_board/docs/screenshots/weblate/aa-bulletin-board-read-more-button.jpg +0 -0
- aa_bulletin_board/forms.py +8 -6
- aa_bulletin_board/helpers.py +15 -6
- aa_bulletin_board/locale/de/LC_MESSAGES/django.mo +0 -0
- aa_bulletin_board/locale/de/LC_MESSAGES/django.po +69 -25
- aa_bulletin_board/locale/django.pot +61 -19
- aa_bulletin_board/locale/es/LC_MESSAGES/django.po +61 -19
- aa_bulletin_board/locale/fr_FR/LC_MESSAGES/django.po +61 -19
- aa_bulletin_board/locale/it_IT/LC_MESSAGES/django.po +61 -19
- aa_bulletin_board/locale/ja/LC_MESSAGES/django.po +61 -19
- aa_bulletin_board/locale/ko_KR/LC_MESSAGES/django.po +61 -19
- aa_bulletin_board/locale/ru/LC_MESSAGES/django.mo +0 -0
- aa_bulletin_board/locale/ru/LC_MESSAGES/django.po +71 -27
- aa_bulletin_board/locale/uk/LC_MESSAGES/django.mo +0 -0
- aa_bulletin_board/locale/uk/LC_MESSAGES/django.po +75 -28
- aa_bulletin_board/locale/zh_Hans/LC_MESSAGES/django.po +61 -19
- aa_bulletin_board/managers.py +8 -3
- aa_bulletin_board/migrations/0001_initial.py +0 -1
- aa_bulletin_board/migrations/0002_alter_bulletin_slug.py +0 -1
- aa_bulletin_board/migrations/0003_group_restrictions.py +0 -1
- aa_bulletin_board/migrations/0004_model_translation.py +71 -0
- aa_bulletin_board/models.py +34 -8
- aa_bulletin_board/static/aa_bulletin_board/css/aa-bootstrap-fix.css +5 -5
- aa_bulletin_board/static/aa_bulletin_board/css/aa-bootstrap-fix.min.css +1 -1
- aa_bulletin_board/static/aa_bulletin_board/css/aa-bulletin-board.css +11 -0
- aa_bulletin_board/static/aa_bulletin_board/css/aa-bulletin-board.min.css +1 -1
- aa_bulletin_board/templates/aa_bulletin_board/base.html +5 -1
- aa_bulletin_board/templates/aa_bulletin_board/bulletin.html +6 -6
- aa_bulletin_board/templates/aa_bulletin_board/bundles/sumoselect-css.html +1 -1
- aa_bulletin_board/templates/aa_bulletin_board/bundles/sumoselect-js.html +1 -1
- aa_bulletin_board/templates/aa_bulletin_board/dashboard.html +9 -7
- aa_bulletin_board/templates/aa_bulletin_board/edit-bulletin.html +7 -5
- aa_bulletin_board/templates/aa_bulletin_board/partials/footer/app-translation-footer.html +11 -0
- aa_bulletin_board/templatetags/aa_bulletin_board_versioned_static.py +2 -1
- aa_bulletin_board/tests/test_access.py +61 -37
- aa_bulletin_board/tests/test_auth_hooks.py +18 -9
- aa_bulletin_board/tests/test_bulletins.py +102 -41
- aa_bulletin_board/tests/test_templatetags.py +9 -6
- aa_bulletin_board/tests/test_user_interface.py +88 -46
- aa_bulletin_board/tests/utils.py +33 -4
- aa_bulletin_board/urls.py +7 -5
- aa_bulletin_board/views.py +86 -33
- {aa_bulletin_board-1.10.0.dist-info → aa_bulletin_board-1.11.0.dist-info}/METADATA +2 -7
- aa_bulletin_board-1.11.0.dist-info/RECORD +63 -0
- {aa_bulletin_board-1.10.0.dist-info → aa_bulletin_board-1.11.0.dist-info}/WHEEL +1 -1
- aa_bulletin_board-1.10.0.dist-info/RECORD +0 -54
- {aa_bulletin_board-1.10.0.dist-info → aa_bulletin_board-1.11.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,16 +1,16 @@
|
|
1
|
-
{% extends
|
1
|
+
{% extends "aa_bulletin_board/base.html" %}
|
2
2
|
|
3
3
|
{% load i18n %}
|
4
4
|
|
5
5
|
{% block aabulletinboard_header %}
|
6
6
|
{% translate "Bulletin Board" as translated_header %}
|
7
|
-
{% include
|
7
|
+
{% include "aa_bulletin_board/partials/header/page-header.html" with header_text=translated_header %}
|
8
8
|
{% endblock %}
|
9
9
|
|
10
10
|
{% block aabulletinboard_body %}
|
11
11
|
{% if perms.aa_bulletin_board.manage_bulletins %}
|
12
12
|
<div class="aa-bulletin-board-management text-right">
|
13
|
-
<a class="btn btn-success btn-read-more" href="{% url 'aa_bulletin_board:create_bulletin' %}">{% translate
|
13
|
+
<a class="btn btn-success btn-read-more" href="{% url 'aa_bulletin_board:create_bulletin' %}">{% translate "Add Bulletin" %}</a>
|
14
14
|
</div>
|
15
15
|
{% endif %}
|
16
16
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<div class="panel-title">
|
24
24
|
{{ bulletin.title }}
|
25
25
|
{% if bulletin.groups.all %}
|
26
|
-
<i class="far fa-eye-slash aa-bulletin-board-marker-group-restrictions" data-title="{% translate
|
26
|
+
<i class="far fa-eye-slash aa-bulletin-board-marker-group-restrictions" data-title="{% translate 'This bulletin is restricted to the following group(s):' %}<br>{{ bulletin.groups.all|join:', ' }}"></i>
|
27
27
|
{% endif %}
|
28
28
|
</div>
|
29
29
|
</div>
|
@@ -34,11 +34,11 @@
|
|
34
34
|
|
35
35
|
<div class="panel-footer-read-more-button panel-footer-no-background">
|
36
36
|
<p>
|
37
|
-
<a class="btn btn-primary btn-sm btn-read-more" href="{% url 'aa_bulletin_board:view_bulletin' bulletin.slug %}">{% translate
|
37
|
+
<a class="btn btn-primary btn-sm btn-read-more" href="{% url 'aa_bulletin_board:view_bulletin' bulletin.slug %}">{% translate "Read more" %}</a>
|
38
38
|
|
39
39
|
{% if perms.aa_bulletin_board.manage_bulletins %}
|
40
|
-
<a class="btn btn-warning btn-sm btn-read-more" href="{% url 'aa_bulletin_board:edit_bulletin' bulletin.slug %}">{% translate
|
41
|
-
<a class="btn btn-danger btn-sm btn-read-more" href="{% url 'aa_bulletin_board:remove_bulletin' bulletin.slug %}">{% translate
|
40
|
+
<a class="btn btn-warning btn-sm btn-read-more" href="{% url 'aa_bulletin_board:edit_bulletin' bulletin.slug %}">{% translate "Edit" %}</a>
|
41
|
+
<a class="btn btn-danger btn-sm btn-read-more" href="{% url 'aa_bulletin_board:remove_bulletin' bulletin.slug %}">{% translate "Delete" %}</a>
|
42
42
|
{% endif %}
|
43
43
|
</p>
|
44
44
|
</div>
|
@@ -52,6 +52,8 @@
|
|
52
52
|
{% block extra_javascript %}
|
53
53
|
<script>
|
54
54
|
$(document).ready(() => {
|
55
|
+
'use strict';
|
56
|
+
|
55
57
|
const resizeBulletinPanel = () => {
|
56
58
|
let highestBox = 0;
|
57
59
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
{% extends
|
1
|
+
{% extends "aa_bulletin_board/base.html" %}
|
2
2
|
|
3
3
|
{% load bootstrap %}
|
4
4
|
{% load i18n %}
|
@@ -14,9 +14,9 @@
|
|
14
14
|
|
15
15
|
{% block aabulletinboard_header %}
|
16
16
|
{% if bulletin %}
|
17
|
-
{% include
|
17
|
+
{% include "aa_bulletin_board/partials/header/page-header.html" with header_text=bulletin.title %}
|
18
18
|
{% else %}
|
19
|
-
{% include
|
19
|
+
{% include "aa_bulletin_board/partials/header/page-header.html" with header_text="Create New Bulletin" %}
|
20
20
|
{% endif %}
|
21
21
|
{% endblock %}
|
22
22
|
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<div class="panel panel-default">
|
25
25
|
<div class="panel-heading">
|
26
26
|
<div class="panel-title">
|
27
|
-
<a class="btn btn-default btn-sm" href="{% if bulletin %}{% url 'aa_bulletin_board:view_bulletin' bulletin.slug %}{% else %}{% url 'aa_bulletin_board:dashboard' %}{% endif %}">{% translate
|
27
|
+
<a class="btn btn-default btn-sm" href="{% if bulletin %}{% url 'aa_bulletin_board:view_bulletin' bulletin.slug %}{% else %}{% url 'aa_bulletin_board:dashboard' %}{% endif %}">{% translate "Back" %}</a>
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
|
@@ -35,7 +35,7 @@
|
|
35
35
|
{{ form|bootstrap }}
|
36
36
|
|
37
37
|
<div class="form-group text-right clearfix">
|
38
|
-
<button class="btn btn-success" type="submit">{% if bulletin %}{% translate
|
38
|
+
<button class="btn btn-success" type="submit">{% if bulletin %}{% translate "Update Bulletin" %}{% else %}{% translate "Create Bulletin" %}{% endif %}</button>
|
39
39
|
</div>
|
40
40
|
</form>
|
41
41
|
</div>
|
@@ -48,6 +48,8 @@
|
|
48
48
|
<script src="{% static "ckeditor/ckeditor-init.js" %}"></script>
|
49
49
|
<script src="{% static "ckeditor/ckeditor/ckeditor.js" %}"></script>
|
50
50
|
<script>
|
51
|
+
'use strict';
|
52
|
+
|
51
53
|
$('.aa-bulletin-boad-edit-bulletin select').SumoSelect(
|
52
54
|
{okCancelInMulti: true, selectAll: true}
|
53
55
|
);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{% load i18n %}
|
2
|
+
|
3
|
+
<div class="app-translation-footer text-muted">
|
4
|
+
<p>
|
5
|
+
{% translate "Do you want to help translate this app into your language or improve the existing translation?" %}
|
6
|
+
-
|
7
|
+
<a href="https://weblate.ppfeufer.de/engage/alliance-auth-apps/" target="_blank" rel="noopener noreferer">
|
8
|
+
{% translate "Join our team of translators!" %}
|
9
|
+
</a>
|
10
|
+
</p>
|
11
|
+
</div>
|
@@ -14,13 +14,14 @@ from aa_bulletin_board import __version__
|
|
14
14
|
def aa_bulletin_board_static(path: str) -> str:
|
15
15
|
"""
|
16
16
|
Versioned static URL
|
17
|
+
|
17
18
|
:param path:
|
18
19
|
:type path:
|
19
20
|
:return:
|
20
21
|
:rtype:
|
21
22
|
"""
|
22
23
|
|
23
|
-
static_url = static(path)
|
24
|
+
static_url = static(path=path)
|
24
25
|
versioned_url = static_url + "?v=" + __version__
|
25
26
|
|
26
27
|
return versioned_url
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"""
|
2
2
|
Testing access to bulletins
|
3
3
|
"""
|
4
|
+
# Standard Library
|
5
|
+
from http import HTTPStatus
|
4
6
|
|
5
7
|
# Third Party
|
6
8
|
from faker import Faker
|
@@ -26,48 +28,57 @@ class TestAccess(TestCase):
|
|
26
28
|
def setUpClass(cls) -> None:
|
27
29
|
"""
|
28
30
|
Set up groups and users
|
31
|
+
|
32
|
+
:return:
|
33
|
+
:rtype:
|
29
34
|
"""
|
30
35
|
|
31
36
|
super().setUpClass()
|
32
37
|
cls.group = Group.objects.create(name="Superhero")
|
33
38
|
|
34
39
|
# User cannot access bulletins
|
35
|
-
cls.user_1001 = create_fake_user(
|
40
|
+
cls.user_1001 = create_fake_user(
|
41
|
+
character_id=1001, character_name="Peter Parker"
|
42
|
+
)
|
36
43
|
|
37
44
|
# User can access bulletins
|
38
45
|
cls.user_1002 = create_fake_user(
|
39
|
-
1002,
|
46
|
+
character_id=1002,
|
47
|
+
character_name="Bruce Wayne",
|
48
|
+
permissions=["aa_bulletin_board.basic_access"],
|
40
49
|
)
|
41
50
|
|
42
51
|
# User can manage bulletins
|
43
52
|
cls.user_1003 = create_fake_user(
|
44
|
-
1003,
|
45
|
-
"Clark Kent",
|
53
|
+
character_id=1003,
|
54
|
+
character_name="Clark Kent",
|
46
55
|
permissions=[
|
47
56
|
"aa_bulletin_board.basic_access",
|
48
57
|
"aa_bulletin_board.manage_bulletins",
|
49
58
|
],
|
50
59
|
)
|
51
60
|
|
52
|
-
def test_should_show_dashboard(self):
|
61
|
+
def test_should_show_dashboard(self) -> None:
|
53
62
|
"""
|
54
63
|
Test that a user with basic_access can see the bulletin board
|
64
|
+
|
55
65
|
:return:
|
56
66
|
:rtype:
|
57
67
|
"""
|
58
68
|
|
59
69
|
# given
|
60
|
-
self.client.force_login(self.user_1002)
|
70
|
+
self.client.force_login(user=self.user_1002)
|
61
71
|
|
62
72
|
# when
|
63
|
-
res = self.client.get(reverse("aa_bulletin_board:dashboard"))
|
73
|
+
res = self.client.get(path=reverse(viewname="aa_bulletin_board:dashboard"))
|
64
74
|
|
65
75
|
# then
|
66
|
-
self.assertEqual(res.status_code,
|
76
|
+
self.assertEqual(first=res.status_code, second=HTTPStatus.OK)
|
67
77
|
|
68
|
-
def test_should_show_bulletin(self):
|
78
|
+
def test_should_show_bulletin(self) -> None:
|
69
79
|
"""
|
70
80
|
Test that a user with basic_access can see the bulletin
|
81
|
+
|
71
82
|
:return:
|
72
83
|
:rtype:
|
73
84
|
"""
|
@@ -78,37 +89,42 @@ class TestAccess(TestCase):
|
|
78
89
|
content=f"<p>{fake.sentence()}</p>",
|
79
90
|
created_by=self.user_1001,
|
80
91
|
)
|
81
|
-
self.client.force_login(self.user_1002)
|
92
|
+
self.client.force_login(user=self.user_1002)
|
82
93
|
|
83
94
|
# when
|
84
95
|
res = self.client.get(
|
85
|
-
reverse(
|
96
|
+
path=reverse(
|
97
|
+
viewname="aa_bulletin_board:view_bulletin",
|
98
|
+
kwargs={"slug": bulletin.slug},
|
99
|
+
)
|
86
100
|
)
|
87
|
-
result = Bulletin.objects.user_has_access(self.user_1002)
|
101
|
+
result = Bulletin.objects.user_has_access(user=self.user_1002)
|
88
102
|
|
89
103
|
# then
|
90
|
-
self.assertEqual(res.status_code,
|
91
|
-
self.assertIn(bulletin, result)
|
104
|
+
self.assertEqual(first=res.status_code, second=HTTPStatus.OK)
|
105
|
+
self.assertIn(member=bulletin, container=result)
|
92
106
|
|
93
|
-
def test_should_not_show_dashboard(self):
|
107
|
+
def test_should_not_show_dashboard(self) -> None:
|
94
108
|
"""
|
95
109
|
Test that a user without basic_access can't see the bulletin board
|
110
|
+
|
96
111
|
:return:
|
97
112
|
:rtype:
|
98
113
|
"""
|
99
114
|
|
100
115
|
# given
|
101
|
-
self.client.force_login(self.user_1001)
|
116
|
+
self.client.force_login(user=self.user_1001)
|
102
117
|
|
103
118
|
# when
|
104
|
-
res = self.client.get(reverse("aa_bulletin_board:dashboard"))
|
119
|
+
res = self.client.get(path=reverse(viewname="aa_bulletin_board:dashboard"))
|
105
120
|
|
106
121
|
# then
|
107
|
-
self.assertIsNot(res.status_code,
|
122
|
+
self.assertIsNot(expr1=res.status_code, expr2=HTTPStatus.OK)
|
108
123
|
|
109
|
-
def test_should_not_show_bulletin(self):
|
124
|
+
def test_should_not_show_bulletin(self) -> None:
|
110
125
|
"""
|
111
126
|
Test that a user without basic_access can't see the bulletin
|
127
|
+
|
112
128
|
:return:
|
113
129
|
:rtype:
|
114
130
|
"""
|
@@ -119,19 +135,23 @@ class TestAccess(TestCase):
|
|
119
135
|
content=f"<p>{fake.sentence()}</p>",
|
120
136
|
created_by=self.user_1001,
|
121
137
|
)
|
122
|
-
self.client.force_login(self.user_1001)
|
138
|
+
self.client.force_login(user=self.user_1001)
|
123
139
|
|
124
140
|
# when
|
125
141
|
res = self.client.get(
|
126
|
-
reverse(
|
142
|
+
path=reverse(
|
143
|
+
viewname="aa_bulletin_board:view_bulletin",
|
144
|
+
kwargs={"slug": bulletin.slug},
|
145
|
+
)
|
127
146
|
)
|
128
147
|
|
129
148
|
# then
|
130
|
-
self.assertIsNot(res.status_code,
|
149
|
+
self.assertIsNot(expr1=res.status_code, expr2=HTTPStatus.OK)
|
131
150
|
|
132
|
-
def test_should_return_bulletin_for_user_with_perm_manage_bulletins(self):
|
151
|
+
def test_should_return_bulletin_for_user_with_perm_manage_bulletins(self) -> None:
|
133
152
|
"""
|
134
153
|
Test that a user with "aa_bulletin_board.manage_bulletins" can see all bulletins
|
154
|
+
|
135
155
|
:return:
|
136
156
|
:rtype:
|
137
157
|
"""
|
@@ -144,17 +164,18 @@ class TestAccess(TestCase):
|
|
144
164
|
)
|
145
165
|
|
146
166
|
# when
|
147
|
-
result = Bulletin.objects.user_has_access(self.user_1003)
|
167
|
+
result = Bulletin.objects.user_has_access(user=self.user_1003)
|
148
168
|
|
149
169
|
# then
|
150
|
-
self.assertIn(bulletin, result)
|
170
|
+
self.assertIn(member=bulletin, container=result)
|
151
171
|
|
152
172
|
def test_should_return_restricted_bulletin_for_user_with_perm_manage_bulletins(
|
153
173
|
self,
|
154
|
-
):
|
174
|
+
) -> None:
|
155
175
|
"""
|
156
176
|
Test that a user with "aa_bulletin_board.manage_bulletins"
|
157
177
|
can see all bulletins, even restricted
|
178
|
+
|
158
179
|
:return:
|
159
180
|
:rtype:
|
160
181
|
"""
|
@@ -168,14 +189,15 @@ class TestAccess(TestCase):
|
|
168
189
|
bulletin.groups.add(self.group)
|
169
190
|
|
170
191
|
# when
|
171
|
-
result = Bulletin.objects.user_has_access(self.user_1003)
|
192
|
+
result = Bulletin.objects.user_has_access(user=self.user_1003)
|
172
193
|
|
173
194
|
# then
|
174
|
-
self.assertIn(bulletin, result)
|
195
|
+
self.assertIn(member=bulletin, container=result)
|
175
196
|
|
176
|
-
def test_should_return_bulletin_with_no_groups(self):
|
197
|
+
def test_should_return_bulletin_with_no_groups(self) -> None:
|
177
198
|
"""
|
178
199
|
Test that any user with access can se non-restricted bulletins
|
200
|
+
|
179
201
|
:return:
|
180
202
|
:rtype:
|
181
203
|
"""
|
@@ -188,14 +210,15 @@ class TestAccess(TestCase):
|
|
188
210
|
)
|
189
211
|
|
190
212
|
# when
|
191
|
-
result = Bulletin.objects.user_has_access(self.user_1002)
|
213
|
+
result = Bulletin.objects.user_has_access(user=self.user_1002)
|
192
214
|
|
193
215
|
# then
|
194
|
-
self.assertIn(bulletin, result)
|
216
|
+
self.assertIn(member=bulletin, container=result)
|
195
217
|
|
196
|
-
def test_should_return_bulletin_for_group_member(self):
|
218
|
+
def test_should_return_bulletin_for_group_member(self) -> None:
|
197
219
|
"""
|
198
220
|
Test that group restricted bulletins are visible for users who have this group
|
221
|
+
|
199
222
|
:return:
|
200
223
|
:rtype:
|
201
224
|
"""
|
@@ -210,15 +233,16 @@ class TestAccess(TestCase):
|
|
210
233
|
self.user_1001.groups.add(self.group)
|
211
234
|
|
212
235
|
# when
|
213
|
-
result = Bulletin.objects.user_has_access(self.user_1001)
|
236
|
+
result = Bulletin.objects.user_has_access(user=self.user_1001)
|
214
237
|
|
215
238
|
# then
|
216
|
-
self.assertIn(bulletin, result)
|
239
|
+
self.assertIn(member=bulletin, container=result)
|
217
240
|
|
218
|
-
def test_should_not_return_bulletin_for_non_group_member(self):
|
241
|
+
def test_should_not_return_bulletin_for_non_group_member(self) -> None:
|
219
242
|
"""
|
220
243
|
Test that group restricted bulletins are not visible for
|
221
244
|
users who don't have this group
|
245
|
+
|
222
246
|
:return:
|
223
247
|
:rtype:
|
224
248
|
"""
|
@@ -232,7 +256,7 @@ class TestAccess(TestCase):
|
|
232
256
|
bulletin.groups.add(self.group)
|
233
257
|
|
234
258
|
# when
|
235
|
-
result = Bulletin.objects.user_has_access(self.user_1002)
|
259
|
+
result = Bulletin.objects.user_has_access(user=self.user_1002)
|
236
260
|
|
237
261
|
# then
|
238
|
-
self.assertNotIn(bulletin, result)
|
262
|
+
self.assertNotIn(member=bulletin, container=result)
|
@@ -22,51 +22,60 @@ class TestHooks(TestCase):
|
|
22
22
|
def setUpClass(cls) -> None:
|
23
23
|
"""
|
24
24
|
Set up groups and users
|
25
|
+
|
26
|
+
:return:
|
27
|
+
:rtype:
|
25
28
|
"""
|
26
29
|
|
27
30
|
super().setUpClass()
|
28
31
|
|
29
32
|
# User cannot access bulletins
|
30
|
-
cls.user_1001 = create_fake_user(
|
33
|
+
cls.user_1001 = create_fake_user(
|
34
|
+
character_id=1001, character_name="Peter Parker"
|
35
|
+
)
|
31
36
|
|
32
37
|
# User can access bulletins
|
33
38
|
cls.user_1002 = create_fake_user(
|
34
|
-
1002,
|
39
|
+
character_id=1002,
|
40
|
+
character_name="Bruce Wayne",
|
41
|
+
permissions=["aa_bulletin_board.basic_access"],
|
35
42
|
)
|
36
43
|
|
37
44
|
cls.html_menu = f"""
|
38
45
|
<li>
|
39
|
-
<a class href="{reverse('aa_bulletin_board:dashboard')}">
|
46
|
+
<a class href="{reverse(viewname='aa_bulletin_board:dashboard')}">
|
40
47
|
<i class="fas fa-clipboard-list fa-fw"></i> Bulletin Board
|
41
48
|
</a>
|
42
49
|
</li>
|
43
50
|
"""
|
44
51
|
|
45
|
-
def test_render_hook_success(self):
|
52
|
+
def test_render_hook_success(self) -> None:
|
46
53
|
"""
|
47
54
|
Test should show the link to the app in the navigation to user with access
|
55
|
+
|
48
56
|
:return:
|
49
57
|
:rtype:
|
50
58
|
"""
|
51
59
|
|
52
|
-
self.client.force_login(self.user_1002)
|
60
|
+
self.client.force_login(user=self.user_1002)
|
53
61
|
|
54
|
-
response = self.client.get(reverse("authentication:dashboard"))
|
62
|
+
response = self.client.get(path=reverse(viewname="authentication:dashboard"))
|
55
63
|
|
56
64
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
57
65
|
self.assertContains(response, self.html_menu, html=True)
|
58
66
|
|
59
|
-
def test_render_hook_fail(self):
|
67
|
+
def test_render_hook_fail(self) -> None:
|
60
68
|
"""
|
61
69
|
Test should not show the link to the app in the
|
62
70
|
navigation to user without access
|
71
|
+
|
63
72
|
:return:
|
64
73
|
:rtype:
|
65
74
|
"""
|
66
75
|
|
67
|
-
self.client.force_login(self.user_1001)
|
76
|
+
self.client.force_login(user=self.user_1001)
|
68
77
|
|
69
|
-
response = self.client.get(reverse("authentication:dashboard"))
|
78
|
+
response = self.client.get(path=reverse(viewname="authentication:dashboard"))
|
70
79
|
|
71
80
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
72
81
|
self.assertNotContains(response, self.html_menu, html=True)
|