wbcore 2.2.1__py2.py3-none-any.whl → 2.2.4__py2.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.
Files changed (143) hide show
  1. wbcore/contrib/agenda/locale/de/LC_MESSAGES/django.po +113 -0
  2. wbcore/contrib/agenda/static/agenda/markdown/documentation/building.md +11 -0
  3. wbcore/contrib/agenda/static/agenda/markdown/documentation/conferenceroom.md +20 -0
  4. wbcore/contrib/authentication/fixtures/authentication.json +62 -0
  5. wbcore/contrib/authentication/locale/de/LC_MESSAGES/django.po +610 -0
  6. wbcore/contrib/authentication/templates/activate_confirm.html +12 -0
  7. wbcore/contrib/authentication/templates/base.html +135 -0
  8. wbcore/contrib/authentication/templates/email_base_template.html +335 -0
  9. wbcore/contrib/authentication/templates/password_reset_done.html +13 -0
  10. wbcore/contrib/authentication/templates/password_reset_email.html +11 -0
  11. wbcore/contrib/authentication/templates/password_reset_email_html.html +43 -0
  12. wbcore/contrib/authentication/templates/password_reset_form.html +23 -0
  13. wbcore/contrib/authentication/templates/password_reset_sent.html +11 -0
  14. wbcore/contrib/authentication/templates/reset_password.html +15 -0
  15. wbcore/contrib/authentication/templates/user_registration_email.html +37 -0
  16. wbcore/contrib/color/admin.py +28 -0
  17. wbcore/contrib/color/apps.py +5 -0
  18. wbcore/contrib/color/enums.py +17 -0
  19. wbcore/contrib/color/factories.py +10 -0
  20. wbcore/contrib/color/fields.py +29 -0
  21. wbcore/contrib/color/forms.py +13 -0
  22. wbcore/contrib/color/models.py +62 -0
  23. wbcore/contrib/color/tests/conftest.py +10 -0
  24. wbcore/contrib/color/tests/test_color_models.py +61 -0
  25. wbcore/contrib/color/tests/test_fields.py +25 -0
  26. wbcore/contrib/currency/fixtures/currency.yaml +1014 -0
  27. wbcore/contrib/currency/fixtures/currency_fx_rate.yaml +73585 -0
  28. wbcore/contrib/directory/fixtures/directory.json +3924 -0
  29. wbcore/contrib/directory/locale/de/LC_MESSAGES/django.po +1686 -0
  30. wbcore/contrib/directory/static/directory/markdown/documentation/address.md +38 -0
  31. wbcore/contrib/directory/static/directory/markdown/documentation/banking.md +54 -0
  32. wbcore/contrib/directory/static/directory/markdown/documentation/bankingentry.md +38 -0
  33. wbcore/contrib/directory/static/directory/markdown/documentation/clientmanagerrelationship.md +42 -0
  34. wbcore/contrib/directory/static/directory/markdown/documentation/company.md +52 -0
  35. wbcore/contrib/directory/static/directory/markdown/documentation/companytype.md +2 -0
  36. wbcore/contrib/directory/static/directory/markdown/documentation/customerstatus.md +2 -0
  37. wbcore/contrib/directory/static/directory/markdown/documentation/email.md +20 -0
  38. wbcore/contrib/directory/static/directory/markdown/documentation/employeecompany.md +34 -0
  39. wbcore/contrib/directory/static/directory/markdown/documentation/employerperson.md +43 -0
  40. wbcore/contrib/directory/static/directory/markdown/documentation/person.md +61 -0
  41. wbcore/contrib/directory/static/directory/markdown/documentation/position.md +2 -0
  42. wbcore/contrib/directory/static/directory/markdown/documentation/relationshiptype.md +2 -0
  43. wbcore/contrib/directory/static/directory/markdown/documentation/socialmedia.md +23 -0
  44. wbcore/contrib/directory/static/directory/markdown/documentation/specialization.md +2 -0
  45. wbcore/contrib/directory/static/directory/markdown/documentation/systememployee.md +31 -0
  46. wbcore/contrib/directory/static/directory/markdown/documentation/telephone.md +23 -0
  47. wbcore/contrib/directory/static/directory/markdown/documentation/telephonesearch.md +26 -0
  48. wbcore/contrib/directory/static/directory/markdown/documentation/userisclient.md +14 -0
  49. wbcore/contrib/directory/static/directory/markdown/documentation/userismanager.md +28 -0
  50. wbcore/contrib/directory/static/directory/markdown/documentation/website.md +20 -0
  51. wbcore/contrib/documents/fixtures/docments.json +135 -0
  52. wbcore/contrib/documents/locale/de/LC_MESSAGES/django.po +272 -0
  53. wbcore/contrib/documents/static/documents/markdown/documentation/document_types.md +21 -0
  54. wbcore/contrib/documents/static/documents/markdown/documentation/documents.md +18 -0
  55. wbcore/contrib/documents/static/documents/markdown/documentation/shareablelink.md +28 -0
  56. wbcore/contrib/documents/static/documents/markdown/documentation/shareablelinkaccess.md +20 -0
  57. wbcore/contrib/documents/tests/conftest.py +30 -0
  58. wbcore/contrib/documents/tests/test_models.py +144 -0
  59. wbcore/contrib/example_app/fixtures/example_app.json +7425 -0
  60. wbcore/contrib/example_app/tests/test_models/test_event.py +87 -0
  61. wbcore/contrib/example_app/tests/test_models/test_match.py +210 -0
  62. wbcore/contrib/example_app/tests/test_models/test_others.py +159 -0
  63. wbcore/contrib/example_app/tests/test_serializers/test_league_serializer.py +34 -0
  64. wbcore/contrib/example_app/tests/test_serializers/test_match_serializer.py +134 -0
  65. wbcore/contrib/example_app/tests/test_serializers/test_role_serializer.py +13 -0
  66. wbcore/contrib/example_app/tests/test_serializers/test_sport_serializer.py +14 -0
  67. wbcore/contrib/example_app/tests/test_serializers/test_stadium_serializer.py +14 -0
  68. wbcore/contrib/example_app/tests/test_serializers/test_team_result_serializer.py +30 -0
  69. wbcore/contrib/example_app/tests/test_serializers/test_team_serializer.py +70 -0
  70. wbcore/contrib/example_app/tests/test_viewsets/test_event_viewset.py +162 -0
  71. wbcore/contrib/example_app/tests/test_viewsets/test_league_viewset.py +84 -0
  72. wbcore/contrib/example_app/tests/test_viewsets/test_match_viewset.py +65 -0
  73. wbcore/contrib/example_app/tests/test_viewsets/test_person_viewset.py +166 -0
  74. wbcore/contrib/example_app/tests/test_viewsets/test_role_viewset.py +75 -0
  75. wbcore/contrib/example_app/tests/test_viewsets/test_sport_viewset.py +75 -0
  76. wbcore/contrib/example_app/tests/test_viewsets/test_stadium_viewset.py +75 -0
  77. wbcore/contrib/example_app/tests/test_viewsets/test_team_viewset.py +92 -0
  78. wbcore/contrib/example_app/tests/test_viewsets/test_teamresult_viewset.py +58 -0
  79. wbcore/contrib/example_app/tests/test_viewsets/test_utils_viewsets.py +124 -0
  80. wbcore/contrib/geography/fixtures/geography.json +13454 -0
  81. wbcore/contrib/geography/static/geography/markdown/documentation/geography.md +16 -0
  82. wbcore/contrib/guardian/apps.py +6 -0
  83. wbcore/contrib/guardian/configurations.py +3 -0
  84. wbcore/contrib/guardian/filters.py +21 -0
  85. wbcore/contrib/guardian/tasks.py +10 -0
  86. wbcore/contrib/guardian/urls.py +12 -0
  87. wbcore/contrib/guardian/utils.py +124 -0
  88. wbcore/contrib/io/fixtures/io.json +145 -0
  89. wbcore/contrib/io/locale/de/LC_MESSAGES/django.po +52 -0
  90. wbcore/contrib/notifications/locale/de/LC_MESSAGES/django.po +60 -0
  91. wbcore/contrib/notifications/static/notifications/service-worker.js +1 -0
  92. wbcore/contrib/notifications/templates/notifications/notification_template.html +43 -0
  93. wbcore/contrib/notifications/viewsets/configs/notification_types.py +27 -0
  94. wbcore/contrib/notifications/viewsets/configs/notifications.py +85 -0
  95. wbcore/contrib/workflow/fixtures/workflow.json +612 -0
  96. wbcore/contrib/workflow/locale/de/LC_MESSAGES/django.po +1289 -0
  97. wbcore/contrib/workflow/static/workflow/markdown/documentation/assignedprocessstep.md +33 -0
  98. wbcore/contrib/workflow/static/workflow/markdown/documentation/condition.md +24 -0
  99. wbcore/contrib/workflow/static/workflow/markdown/documentation/decisionstep.md +30 -0
  100. wbcore/contrib/workflow/static/workflow/markdown/documentation/emailstep.md +45 -0
  101. wbcore/contrib/workflow/static/workflow/markdown/documentation/finishstep.md +33 -0
  102. wbcore/contrib/workflow/static/workflow/markdown/documentation/joinstep.md +33 -0
  103. wbcore/contrib/workflow/static/workflow/markdown/documentation/process.md +33 -0
  104. wbcore/contrib/workflow/static/workflow/markdown/documentation/processstep.md +51 -0
  105. wbcore/contrib/workflow/static/workflow/markdown/documentation/scriptstep.md +33 -0
  106. wbcore/contrib/workflow/static/workflow/markdown/documentation/splitstep.md +30 -0
  107. wbcore/contrib/workflow/static/workflow/markdown/documentation/startstep.md +27 -0
  108. wbcore/contrib/workflow/static/workflow/markdown/documentation/transition.md +27 -0
  109. wbcore/contrib/workflow/static/workflow/markdown/documentation/userstep.md +42 -0
  110. wbcore/contrib/workflow/static/workflow/markdown/documentation/workflow.md +32 -0
  111. wbcore/contrib/workflow/templates/Test_Templates.txt +25 -0
  112. wbcore/contrib/workflow/tests/test_models/step/test_decision_step.py +79 -0
  113. wbcore/contrib/workflow/tests/test_models/step/test_email_step.py +45 -0
  114. wbcore/contrib/workflow/tests/test_models/step/test_finish_step.py +105 -0
  115. wbcore/contrib/workflow/tests/test_models/step/test_join_step.py +127 -0
  116. wbcore/contrib/workflow/tests/test_models/step/test_script_step.py +24 -0
  117. wbcore/contrib/workflow/tests/test_models/step/test_split_step.py +49 -0
  118. wbcore/contrib/workflow/tests/test_models/step/test_step.py +621 -0
  119. wbcore/contrib/workflow/tests/test_models/step/test_user_step.py +225 -0
  120. wbcore/contrib/workflow/tests/test_models/test_condition.py +103 -0
  121. wbcore/contrib/workflow/tests/test_models/test_data.py +134 -0
  122. wbcore/contrib/workflow/tests/test_models/test_process.py +98 -0
  123. wbcore/contrib/workflow/tests/test_models/test_transition.py +128 -0
  124. wbcore/contrib/workflow/tests/test_models/test_workflow.py +358 -0
  125. wbcore/locale/de/LC_MESSAGES/django.po +667 -0
  126. wbcore/templates/errors/404.html +134 -0
  127. wbcore/templates/errors/500.html +138 -0
  128. wbcore/templates/errors/503.html +132 -0
  129. wbcore/templates/errors/custom.html +132 -0
  130. wbcore/templates/forms.py +0 -0
  131. wbcore/templates/notifications/email_template.html +43 -0
  132. wbcore/templates/wbcore/admin/change_list.html +8 -0
  133. wbcore/templates/wbcore/admin/csv_form.html +15 -0
  134. wbcore/templates/wbcore/dynamic_color_array.html +29 -0
  135. wbcore/templates/wbcore/email_base_template.html +335 -0
  136. wbcore/templates/wbcore/email_notification_template.html +10 -0
  137. wbcore/templates/wbcore/frontend.html +51 -0
  138. wbcore/test/e2e_helpers_methods/e2e_checks.py +121 -0
  139. wbcore/test/e2e_helpers_methods/e2e_helper_methods.py +395 -0
  140. wbcore/tests/test_permissions/test_backend.py +29 -0
  141. {wbcore-2.2.1.dist-info → wbcore-2.2.4.dist-info}/METADATA +1 -1
  142. {wbcore-2.2.1.dist-info → wbcore-2.2.4.dist-info}/RECORD +143 -3
  143. {wbcore-2.2.1.dist-info → wbcore-2.2.4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,21 @@
1
+ # Document Types:
2
+ A list of document types used to categorize documents. Types are saved as a tree with the possibility of adding parent types to each node.
3
+
4
+
5
+ ## Columns:
6
+ Each column title has three lines on the right if you hover over it. Click on them to show options for that column. The second tab of the options menu will allow you to filter the column, the third to completely hide entire columns. Click on anywhere else on the column to order it, cycling between ascending, descending and no ordering. Hold shift while clicking to order multiple columns with individual weights.
7
+
8
+ ### Name:
9
+ The name of the document type.
10
+ ### Parent:
11
+ The document type's parent type.
12
+
13
+ ## Buttons:
14
+ ### All Children:
15
+ Displays a list of all child types of this document type.
16
+
17
+ ### All Documents:
18
+ Displays a list with all documents of this type.
19
+
20
+ ## Search Field:
21
+ Typing in the search field allows to filter the document types by name.
@@ -0,0 +1,18 @@
1
+ # Documents:
2
+ A list of documents uploaded to the workbench.
3
+
4
+
5
+ ## Columns:
6
+ Each column title has three lines on the right if you hover over it. Click on them to show options for that column. The second tab of the options menu will allow you to filter the column, the third to completely hide entire columns. Click on anywhere else on the column to order it, cycling between ascending, descending and no ordering. Hold shift while clicking to order multiple columns with individual weights.
7
+
8
+ ### Name:
9
+ The name of the document.
10
+ ### Type:
11
+ The document's type. Types can be added and edited under DMS > Document Types.
12
+
13
+ ## Buttons:
14
+ ### Download:
15
+ Download this document on your computer.
16
+
17
+ ## Search Field:
18
+ Typing in the search field allows to filter the documents by name.
@@ -0,0 +1,28 @@
1
+ # Shareable Links:
2
+ A list of links to share the selected document.
3
+
4
+
5
+ ## Columns:
6
+ Each column title has three lines on the right if you hover over it. Click on them to show options for that column. The second tab of the options menu will allow you to filter the column, the third to completely hide entire columns. Click on anywhere else on the column to order it, cycling between ascending, descending and no ordering. Hold shift while clicking to order multiple columns with individual weights.
7
+ ### Valid Until:
8
+ Date and time at which the link loses its validity.
9
+ ### One Time Link:
10
+ Specifies if the link can be accessed only one time or and infinite amount.
11
+ ### Link:
12
+ The URL under which the document can be accessed.
13
+
14
+ ## Buttons:
15
+ ### Invalidate:
16
+ Invalidate the selected link manually even if the validation date lies in the future.
17
+
18
+ ## Legend:
19
+ Click on the legend to filter by link validity.
20
+
21
+ ## Filters:
22
+ ### Valid:
23
+ Filter by link validity.
24
+ ### Document:
25
+ Display links for a specific document. Will default to the current document displayed.
26
+
27
+ ## Search Field:
28
+ Typing in the search field allows to filter by link uuid.
@@ -0,0 +1,20 @@
1
+ # Hits:
2
+ A list of IP addresses that accessed the selected link.
3
+
4
+
5
+ ## Columns:
6
+ Each column title has three lines on the right if you hover over it. Click on them to show options for that column. The second tab of the options menu will allow you to filter the column, the third to completely hide entire columns. Click on anywhere else on the column to order it, cycling between ascending, descending and no ordering. Hold shift while clicking to order multiple columns with individual weights.
7
+
8
+ ### Accessed:
9
+ Date and time at which the link was accessed.
10
+ ### IP Address:
11
+ The IP address that accessed the link.
12
+ ### Meta Data:
13
+ The meta data that was provided when the link was accessed. Comprised of things like operating system and browser name.
14
+
15
+ ## Filters:
16
+ ### Shareable Link:
17
+ Display hits for a specific link. Will default to the current link displayed.
18
+
19
+ ## Search Field:
20
+ Typing in the search field allows to filter by IP address.
@@ -0,0 +1,30 @@
1
+ import pytest
2
+ from django.apps import apps
3
+ from django.db import connection
4
+ from django.db.models.signals import pre_migrate
5
+ from pytest_factoryboy import register
6
+ from wbcore.contrib.documents.factories import (
7
+ DocumentFactory,
8
+ DocumentTypeFactory,
9
+ ShareableLinkAccessFactory,
10
+ ShareableLinkFactory,
11
+ )
12
+ from wbcore.contrib.geography.tests.signals import app_pre_migration
13
+ from wbcore.tests.conftest import *
14
+
15
+ register(DocumentFactory)
16
+ register(DocumentTypeFactory)
17
+ register(ShareableLinkAccessFactory)
18
+ register(ShareableLinkFactory)
19
+
20
+
21
+ @pytest.fixture(
22
+ autouse=True, scope="session"
23
+ ) # Might want to find a way to registered default conftest logic automatically
24
+ def django_test_environment(django_test_environment):
25
+ from django.apps import apps
26
+
27
+ get_models = apps.get_models
28
+
29
+ for m in [m for m in get_models() if not m._meta.managed]:
30
+ m._meta.managed = True
@@ -0,0 +1,144 @@
1
+ import os
2
+ from datetime import timedelta
3
+ from unittest.mock import patch
4
+
5
+ import pytest
6
+ from django.core import mail
7
+ from django.core.validators import URLValidator
8
+ from django.utils import timezone
9
+ from faker import Faker
10
+ from slugify import slugify
11
+ from wbcore.contrib.documents.models.documents import (
12
+ Document,
13
+ send_email_as_task,
14
+ upload_to,
15
+ )
16
+
17
+ fake = Faker()
18
+
19
+
20
+ @pytest.mark.django_db
21
+ class TestDocumentModel:
22
+ def test_init(self, document):
23
+ assert document.id is not None
24
+
25
+ @pytest.mark.parametrize(
26
+ "filename",
27
+ [(fake.file_name())],
28
+ )
29
+ def test_upload_to(self, document, document_type_factory, filename):
30
+ parent_document_type = document_type_factory.create()
31
+ document_type = document_type_factory.create(parent=parent_document_type)
32
+ document.document_type = document_type
33
+ document.save()
34
+ assert (
35
+ upload_to(document, filename)
36
+ == f"dms/document/{slugify(parent_document_type.name)}/{slugify(document_type.name)}/{filename}"
37
+ )
38
+
39
+ @pytest.mark.parametrize(
40
+ "document__file",
41
+ [(fake.file_path())],
42
+ )
43
+ def test_filename(self, document):
44
+ assert document.filename == os.path.basename(document.file.name)
45
+
46
+ def test_linked_objects(self, document_factory):
47
+ document = document_factory.create()
48
+ link_obj = document_factory.create()
49
+ document.link(link_obj)
50
+ assert list(document.linked_objects)[0] == link_obj
51
+
52
+ @pytest.mark.parametrize(
53
+ "sharing_seconds_duration, one_time_link",
54
+ [(0, False), (fake.pyint(min_value=1), False), (0, True), (fake.pyint(min_value=1), True)],
55
+ )
56
+ def test_generate_shareable_link(self, document, sharing_seconds_duration, one_time_link):
57
+ document.generate_shareable_link(
58
+ sharing_seconds_duration=sharing_seconds_duration, one_time_link=one_time_link
59
+ )
60
+ assert (
61
+ document.shareable_links.filter(
62
+ valid_until__isnull=sharing_seconds_duration == 0, one_time_link=one_time_link
63
+ ).count()
64
+ == 1
65
+ )
66
+
67
+ @patch("wbcore.contrib.documents.models.documents.send_email_as_task.delay")
68
+ @pytest.mark.parametrize(
69
+ "to_emails",
70
+ [(fake.email())],
71
+ )
72
+ def test_send_email(self, mock_fct, document, to_emails):
73
+ document.send_email(to_emails)
74
+ assert mock_fct.call_count == 1
75
+
76
+ def test_get_for_object(self, document_factory):
77
+ document = document_factory.create()
78
+ link_obj = document_factory.create()
79
+ document.link(link_obj)
80
+ assert Document.get_for_object(link_obj).first() == document
81
+
82
+ @pytest.mark.parametrize(
83
+ "to_emails, as_link, subject, from_email, body",
84
+ [
85
+ (fake.email(), False, None, None, None),
86
+ (fake.email(), False, fake.paragraph(), fake.email(), fake.paragraph()),
87
+ (fake.email(), True, None, None, None),
88
+ ],
89
+ )
90
+ def test_send_email_as_task(self, document, to_emails, as_link, subject, from_email, body):
91
+ assert len(mail.outbox) == 0
92
+ send_email_as_task(document.id, to_emails, as_link=as_link, subject=subject, from_email=from_email, body=body)
93
+ assert len(mail.outbox) == 1
94
+ msg = mail.outbox[0]
95
+ if as_link:
96
+ assert document.shareable_links.count() == 1
97
+ assert len(msg.attachments) == 0
98
+ assert len(msg.alternatives) == 1
99
+ else:
100
+ assert document.shareable_links.count() == 0
101
+ assert len(msg.attachments) == 1
102
+ assert len(msg.alternatives) == 2
103
+ assert msg
104
+
105
+
106
+ @pytest.mark.django_db
107
+ class TestDocumentTypeModel:
108
+ def test_init(self, document_type):
109
+ assert document_type.id is not None
110
+
111
+ def test_str(self, document_type_factory):
112
+ document_type = document_type_factory.create(parent=document_type_factory.create())
113
+ document_type.save()
114
+ assert str(document_type) == document_type.compute_str()
115
+
116
+
117
+ @pytest.mark.django_db
118
+ class TestShareableLinkModel:
119
+ @pytest.mark.parametrize(
120
+ "shareable_link__manual_invalid, shareable_link__valid_until, shareable_link__one_time_link",
121
+ [(True, None, False), (False, timezone.now() - timedelta(seconds=60), False), (False, None, True)],
122
+ )
123
+ def test_unvalid_link(self, shareable_link):
124
+ if shareable_link.one_time_link:
125
+ assert shareable_link.is_valid()
126
+ shareable_link.access()
127
+ assert not shareable_link.is_valid()
128
+
129
+ def test_link(self, shareable_link):
130
+ URLValidator()(shareable_link.link)
131
+
132
+ def test_access(self, shareable_link):
133
+ assert shareable_link.accesses.count() == 0
134
+ shareable_link.access()
135
+ assert shareable_link.accesses.count() == 1
136
+
137
+ def test_init(self, shareable_link):
138
+ assert shareable_link.id is not None
139
+
140
+
141
+ @pytest.mark.django_db
142
+ class TestShareableLinkAccessModel:
143
+ def test_init(self, shareable_link_access):
144
+ assert shareable_link_access.id is not None