codeforlife-portal 6.45.6__py2.py3-none-any.whl → 6.46.0__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.
Potentially problematic release.
This version of codeforlife-portal might be problematic. Click here for more details.
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.0.dist-info}/METADATA +2 -2
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.0.dist-info}/RECORD +19 -11
- portal/__init__.py +1 -1
- portal/static/portal/img/howe_dell_1.png +0 -0
- portal/static/portal/img/howe_dell_2.png +0 -0
- portal/static/portal/img/howe_dell_3.png +0 -0
- portal/static/portal/img/long_europe_map.png +0 -0
- portal/static/portal/img/ten_year_map_pin.svg +1 -0
- portal/static/portal/js/tenYearMap.js +14 -0
- portal/static/portal/sass/partials/_carousel.scss +21 -0
- portal/static/portal/sass/partials/_images.scss +281 -0
- portal/strings/ten_year_map.py +13 -0
- portal/templates/portal/ten_year_map.html +147 -0
- portal/tests/test_views.py +53 -151
- portal/urls.py +22 -39
- portal/views/home.py +82 -37
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.0.dist-info}/LICENSE.md +0 -0
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.0.dist-info}/WHEEL +0 -0
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.0.dist-info}/top_level.txt +0 -0
portal/tests/test_views.py
CHANGED
|
@@ -55,9 +55,7 @@ class TestTeacherViews(TestCase):
|
|
|
55
55
|
cls.email, cls.password = signup_teacher_directly()
|
|
56
56
|
cls.school = create_organisation_directly(cls.email)
|
|
57
57
|
_, _, cls.class_access_code = create_class_directly(cls.email)
|
|
58
|
-
_, cls.password_student, cls.student = create_school_student_directly(
|
|
59
|
-
cls.class_access_code
|
|
60
|
-
)
|
|
58
|
+
_, cls.password_student, cls.student = create_school_student_directly(cls.class_access_code)
|
|
61
59
|
|
|
62
60
|
def login(self):
|
|
63
61
|
c = Client()
|
|
@@ -66,9 +64,7 @@ class TestTeacherViews(TestCase):
|
|
|
66
64
|
|
|
67
65
|
def test_reminder_cards(self):
|
|
68
66
|
c = self.login()
|
|
69
|
-
url = reverse(
|
|
70
|
-
"teacher_print_reminder_cards", args=[self.class_access_code]
|
|
71
|
-
)
|
|
67
|
+
url = reverse("teacher_print_reminder_cards", args=[self.class_access_code])
|
|
72
68
|
|
|
73
69
|
# First test with 2 dummy students
|
|
74
70
|
NAME1 = "Test name"
|
|
@@ -102,9 +98,7 @@ class TestTeacherViews(TestCase):
|
|
|
102
98
|
# page number
|
|
103
99
|
students_per_page = REMINDER_CARDS_PDF_ROWS * REMINDER_CARDS_PDF_COLUMNS
|
|
104
100
|
for _ in range(len(studentlist), students_per_page + 1):
|
|
105
|
-
studentlist.append(
|
|
106
|
-
{"name": NAME1, "password": PASSWORD1, "login_url": URL}
|
|
107
|
-
)
|
|
101
|
+
studentlist.append({"name": NAME1, "password": PASSWORD1, "login_url": URL})
|
|
108
102
|
|
|
109
103
|
assert len(studentlist) == students_per_page + 1
|
|
110
104
|
|
|
@@ -143,9 +137,7 @@ class TestTeacherViews(TestCase):
|
|
|
143
137
|
reader = csv.reader(io.StringIO(content))
|
|
144
138
|
|
|
145
139
|
access_code = self.class_access_code
|
|
146
|
-
class_url = reverse(
|
|
147
|
-
"student_login", kwargs={"access_code": access_code}
|
|
148
|
-
)
|
|
140
|
+
class_url = reverse("student_login", kwargs={"access_code": access_code})
|
|
149
141
|
row0 = next(reader)
|
|
150
142
|
assert row0[0].strip() == access_code
|
|
151
143
|
assert class_url in row0[1].strip()
|
|
@@ -184,9 +176,7 @@ class TestTeacherViews(TestCase):
|
|
|
184
176
|
|
|
185
177
|
def test_daily_activity_student_details(self):
|
|
186
178
|
c = self.login()
|
|
187
|
-
url = reverse(
|
|
188
|
-
"teacher_print_reminder_cards", args=[self.class_access_code]
|
|
189
|
-
)
|
|
179
|
+
url = reverse("teacher_print_reminder_cards", args=[self.class_access_code])
|
|
190
180
|
|
|
191
181
|
data = {
|
|
192
182
|
"data": json.dumps(
|
|
@@ -234,9 +224,7 @@ class TestTeacherViews(TestCase):
|
|
|
234
224
|
|
|
235
225
|
def test_release_verified_student(self):
|
|
236
226
|
c = Client()
|
|
237
|
-
student_login_url = reverse(
|
|
238
|
-
"student_login", args=[self.class_access_code]
|
|
239
|
-
)
|
|
227
|
+
student_login_url = reverse("student_login", args=[self.class_access_code])
|
|
240
228
|
response = c.post(
|
|
241
229
|
student_login_url,
|
|
242
230
|
{
|
|
@@ -252,9 +240,7 @@ class TestTeacherViews(TestCase):
|
|
|
252
240
|
c.logout()
|
|
253
241
|
c.login(username=self.email, password=self.password)
|
|
254
242
|
|
|
255
|
-
release_url = reverse(
|
|
256
|
-
"teacher_dismiss_students", args=[self.class_access_code]
|
|
257
|
-
)
|
|
243
|
+
release_url = reverse("teacher_dismiss_students", args=[self.class_access_code])
|
|
258
244
|
response = c.post(
|
|
259
245
|
release_url,
|
|
260
246
|
{
|
|
@@ -291,9 +277,7 @@ class TestLoginViews(TestCase):
|
|
|
291
277
|
teacher_email, teacher_password = signup_teacher_directly()
|
|
292
278
|
create_organisation_directly(teacher_email)
|
|
293
279
|
_, _, class_access_code = create_class_directly(teacher_email)
|
|
294
|
-
student_name, student_password, _ = create_school_student_directly(
|
|
295
|
-
class_access_code
|
|
296
|
-
)
|
|
280
|
+
student_name, student_password, _ = create_school_student_directly(class_access_code)
|
|
297
281
|
|
|
298
282
|
return (
|
|
299
283
|
teacher_email,
|
|
@@ -326,16 +310,9 @@ class TestLoginViews(TestCase):
|
|
|
326
310
|
_, _, name, password, class_access_code = self._set_up_test_data()
|
|
327
311
|
|
|
328
312
|
if next_url:
|
|
329
|
-
url = (
|
|
330
|
-
reverse(
|
|
331
|
-
"student_login", kwargs={"access_code": class_access_code}
|
|
332
|
-
)
|
|
333
|
-
+ "?next=/"
|
|
334
|
-
)
|
|
313
|
+
url = reverse("student_login", kwargs={"access_code": class_access_code}) + "?next=/"
|
|
335
314
|
else:
|
|
336
|
-
url = reverse(
|
|
337
|
-
"student_login", kwargs={"access_code": class_access_code}
|
|
338
|
-
)
|
|
315
|
+
url = reverse("student_login", kwargs={"access_code": class_access_code})
|
|
339
316
|
|
|
340
317
|
c = Client()
|
|
341
318
|
response = c.post(url, {"username": name, "password": password})
|
|
@@ -374,9 +351,7 @@ class TestLoginViews(TestCase):
|
|
|
374
351
|
|
|
375
352
|
def _get_user_class(self, name, class_access_code):
|
|
376
353
|
klass = Class.objects.get(access_code=class_access_code)
|
|
377
|
-
students = Student.objects.filter(
|
|
378
|
-
new_user__first_name__iexact=name, class_field=klass
|
|
379
|
-
)
|
|
354
|
+
students = Student.objects.filter(new_user__first_name__iexact=name, class_field=klass)
|
|
380
355
|
assert len(students) == 1
|
|
381
356
|
user = students[0].new_user
|
|
382
357
|
return user, klass
|
|
@@ -418,9 +393,7 @@ class TestLoginViews(TestCase):
|
|
|
418
393
|
_, _, name, password, class_access_code = self._set_up_test_data()
|
|
419
394
|
|
|
420
395
|
c = Client()
|
|
421
|
-
url = reverse(
|
|
422
|
-
"student_login", kwargs={"access_code": class_access_code}
|
|
423
|
-
)
|
|
396
|
+
url = reverse("student_login", kwargs={"access_code": class_access_code})
|
|
424
397
|
c.post(url, {"username": name, "password": password})
|
|
425
398
|
|
|
426
399
|
# check if there's a UserSession data within the last 10 secs
|
|
@@ -441,9 +414,7 @@ class TestLoginViews(TestCase):
|
|
|
441
414
|
randomname = "randomname"
|
|
442
415
|
|
|
443
416
|
c = Client()
|
|
444
|
-
url = reverse(
|
|
445
|
-
"student_login", kwargs={"access_code": class_access_code}
|
|
446
|
-
)
|
|
417
|
+
url = reverse("student_login", kwargs={"access_code": class_access_code})
|
|
447
418
|
c.post(url, {"username": randomname, "password": "xx"})
|
|
448
419
|
|
|
449
420
|
# check if there's a UserSession data within the last 10 secs
|
|
@@ -469,9 +440,7 @@ class TestLoginViews(TestCase):
|
|
|
469
440
|
|
|
470
441
|
def test_student_direct_login(self):
|
|
471
442
|
_, _, _, _, class_access_code = self._set_up_test_data()
|
|
472
|
-
student, login_id, _, _ = create_student_with_direct_login(
|
|
473
|
-
class_access_code
|
|
474
|
-
)
|
|
443
|
+
student, login_id, _, _ = create_student_with_direct_login(class_access_code)
|
|
475
444
|
|
|
476
445
|
c = Client()
|
|
477
446
|
assert c.login(user_id=student.new_user.id, login_id=login_id) == True
|
|
@@ -542,6 +511,12 @@ class TestViews(TestCase):
|
|
|
542
511
|
response = c.get(page_url)
|
|
543
512
|
assert response.status_code == 200
|
|
544
513
|
|
|
514
|
+
def test_ten_year_map(self):
|
|
515
|
+
c = Client()
|
|
516
|
+
page_url = reverse("celebrate")
|
|
517
|
+
response = c.get(page_url)
|
|
518
|
+
assert response.status_code == 200
|
|
519
|
+
|
|
545
520
|
def test_student_dashboard_view(self):
|
|
546
521
|
teacher_email, teacher_password = signup_teacher_directly()
|
|
547
522
|
create_organisation_directly(teacher_email)
|
|
@@ -593,9 +568,7 @@ class TestViews(TestCase):
|
|
|
593
568
|
c = Client()
|
|
594
569
|
|
|
595
570
|
# Login and check initial data
|
|
596
|
-
url = reverse(
|
|
597
|
-
"student_login", kwargs={"access_code": class_access_code}
|
|
598
|
-
)
|
|
571
|
+
url = reverse("student_login", kwargs={"access_code": class_access_code})
|
|
599
572
|
c.post(url, {"username": student_name, "password": student_password})
|
|
600
573
|
|
|
601
574
|
student_dashboard_url = reverse("student_details")
|
|
@@ -674,9 +647,7 @@ class TestViews(TestCase):
|
|
|
674
647
|
|
|
675
648
|
# try again with the correct password
|
|
676
649
|
url = reverse("delete_account")
|
|
677
|
-
response = c.post(
|
|
678
|
-
url, {"password": password, "unsubscribe_newsletter": "on"}
|
|
679
|
-
)
|
|
650
|
+
response = c.post(url, {"password": password, "unsubscribe_newsletter": "on"})
|
|
680
651
|
|
|
681
652
|
assert response.status_code == 302
|
|
682
653
|
mock_send_dotdigital_email.assert_called_once()
|
|
@@ -758,9 +729,7 @@ class TestViews(TestCase):
|
|
|
758
729
|
|
|
759
730
|
school_id = school.id
|
|
760
731
|
school_name = school.name
|
|
761
|
-
teachers = Teacher.objects.filter(school=school).order_by(
|
|
762
|
-
"new_user__last_name", "new_user__first_name"
|
|
763
|
-
)
|
|
732
|
+
teachers = Teacher.objects.filter(school=school).order_by("new_user__last_name", "new_user__first_name")
|
|
764
733
|
assert len(teachers) == 3
|
|
765
734
|
|
|
766
735
|
# one of the remaining teachers should be admin (the second in our case, as it's alphabetical)
|
|
@@ -791,9 +760,7 @@ class TestViews(TestCase):
|
|
|
791
760
|
self.assertEqual(mock_send_dotdigital_email.call_count, 2)
|
|
792
761
|
|
|
793
762
|
# 2 teachers left
|
|
794
|
-
teachers = Teacher.objects.filter(school=school).order_by(
|
|
795
|
-
"new_user__last_name", "new_user__first_name"
|
|
796
|
-
)
|
|
763
|
+
teachers = Teacher.objects.filter(school=school).order_by("new_user__last_name", "new_user__first_name")
|
|
797
764
|
assert len(teachers) == 2
|
|
798
765
|
|
|
799
766
|
# teacher2 should still be admin, teacher4 is not passed admin role because there is teacher2
|
|
@@ -805,9 +772,7 @@ class TestViews(TestCase):
|
|
|
805
772
|
# delete teacher4
|
|
806
773
|
anonymise(user4)
|
|
807
774
|
|
|
808
|
-
teachers = Teacher.objects.filter(school=school).order_by(
|
|
809
|
-
"new_user__last_name", "new_user__first_name"
|
|
810
|
-
)
|
|
775
|
+
teachers = Teacher.objects.filter(school=school).order_by("new_user__last_name", "new_user__first_name")
|
|
811
776
|
assert len(teachers) == 1
|
|
812
777
|
u = User.objects.get(id=usrid2)
|
|
813
778
|
assert u.new_teacher.is_admin
|
|
@@ -865,17 +830,13 @@ class TestViews(TestCase):
|
|
|
865
830
|
c.logout()
|
|
866
831
|
|
|
867
832
|
@patch("common.helpers.emails.send_dotdigital_email")
|
|
868
|
-
def test_registrations_increment_data(
|
|
869
|
-
self, mock_send_dotdigital_email: Mock
|
|
870
|
-
):
|
|
833
|
+
def test_registrations_increment_data(self, mock_send_dotdigital_email: Mock):
|
|
871
834
|
c = Client()
|
|
872
835
|
|
|
873
836
|
total_activity = TotalActivity.objects.get(id=1)
|
|
874
837
|
teacher_registration_count = total_activity.teacher_registrations
|
|
875
838
|
student_registration_count = total_activity.student_registrations
|
|
876
|
-
independent_registration_count =
|
|
877
|
-
total_activity.independent_registrations
|
|
878
|
-
)
|
|
839
|
+
independent_registration_count = total_activity.independent_registrations
|
|
879
840
|
|
|
880
841
|
response = c.post(
|
|
881
842
|
reverse("register"),
|
|
@@ -895,10 +856,7 @@ class TestViews(TestCase):
|
|
|
895
856
|
|
|
896
857
|
total_activity = TotalActivity.objects.get(id=1)
|
|
897
858
|
|
|
898
|
-
assert
|
|
899
|
-
total_activity.teacher_registrations
|
|
900
|
-
== teacher_registration_count + 1
|
|
901
|
-
)
|
|
859
|
+
assert total_activity.teacher_registrations == teacher_registration_count + 1
|
|
902
860
|
|
|
903
861
|
response = c.post(
|
|
904
862
|
reverse("register"),
|
|
@@ -920,10 +878,7 @@ class TestViews(TestCase):
|
|
|
920
878
|
|
|
921
879
|
total_activity = TotalActivity.objects.get(id=1)
|
|
922
880
|
|
|
923
|
-
assert
|
|
924
|
-
total_activity.independent_registrations
|
|
925
|
-
== independent_registration_count + 1
|
|
926
|
-
)
|
|
881
|
+
assert total_activity.independent_registrations == independent_registration_count + 1
|
|
927
882
|
|
|
928
883
|
teacher_email, teacher_password = signup_teacher_directly()
|
|
929
884
|
create_organisation_directly(teacher_email)
|
|
@@ -939,10 +894,7 @@ class TestViews(TestCase):
|
|
|
939
894
|
|
|
940
895
|
total_activity = TotalActivity.objects.get(id=1)
|
|
941
896
|
|
|
942
|
-
assert
|
|
943
|
-
total_activity.student_registrations
|
|
944
|
-
== student_registration_count + 3
|
|
945
|
-
)
|
|
897
|
+
assert total_activity.student_registrations == student_registration_count + 3
|
|
946
898
|
|
|
947
899
|
|
|
948
900
|
# CRON view tests
|
|
@@ -961,12 +913,8 @@ class CronTestClient(APIClient):
|
|
|
961
913
|
secure=False,
|
|
962
914
|
**extra,
|
|
963
915
|
):
|
|
964
|
-
wsgi_response = super().generic(
|
|
965
|
-
|
|
966
|
-
)
|
|
967
|
-
assert (
|
|
968
|
-
200 <= wsgi_response.status_code < 300
|
|
969
|
-
), f"Response has error status code: {wsgi_response.status_code}"
|
|
916
|
+
wsgi_response = super().generic(method, path, data, content_type, secure, **extra)
|
|
917
|
+
assert 200 <= wsgi_response.status_code < 300, f"Response has error status code: {wsgi_response.status_code}"
|
|
970
918
|
|
|
971
919
|
return wsgi_response
|
|
972
920
|
|
|
@@ -985,9 +933,7 @@ class TestUser(CronTestCase):
|
|
|
985
933
|
indy_email, _, _ = create_independent_student_directly()
|
|
986
934
|
|
|
987
935
|
self.teacher_user = User.objects.get(email=teacher_email)
|
|
988
|
-
self.teacher_user_profile = UserProfile.objects.get(
|
|
989
|
-
user=self.teacher_user
|
|
990
|
-
)
|
|
936
|
+
self.teacher_user_profile = UserProfile.objects.get(user=self.teacher_user)
|
|
991
937
|
|
|
992
938
|
self.indy_user = User.objects.get(email=indy_email)
|
|
993
939
|
self.indy_user_profile = UserProfile.objects.get(user=self.indy_user)
|
|
@@ -1003,17 +949,11 @@ class TestUser(CronTestCase):
|
|
|
1003
949
|
assert_called: bool,
|
|
1004
950
|
mock_send_dotdigital_email: Mock,
|
|
1005
951
|
):
|
|
1006
|
-
self.teacher_user.date_joined = timezone.now() - timedelta(
|
|
1007
|
-
days=days, hours=12
|
|
1008
|
-
)
|
|
952
|
+
self.teacher_user.date_joined = timezone.now() - timedelta(days=days, hours=12)
|
|
1009
953
|
self.teacher_user.save()
|
|
1010
|
-
self.student_user.date_joined = timezone.now() - timedelta(
|
|
1011
|
-
days=days, hours=12
|
|
1012
|
-
)
|
|
954
|
+
self.student_user.date_joined = timezone.now() - timedelta(days=days, hours=12)
|
|
1013
955
|
self.student_user.save()
|
|
1014
|
-
self.indy_user.date_joined = timezone.now() - timedelta(
|
|
1015
|
-
days=days, hours=12
|
|
1016
|
-
)
|
|
956
|
+
self.indy_user.date_joined = timezone.now() - timedelta(days=days, hours=12)
|
|
1017
957
|
self.indy_user.save()
|
|
1018
958
|
|
|
1019
959
|
self.teacher_user_profile.is_verified = is_verified
|
|
@@ -1024,13 +964,9 @@ class TestUser(CronTestCase):
|
|
|
1024
964
|
self.client.get(reverse(view_name))
|
|
1025
965
|
|
|
1026
966
|
if assert_called:
|
|
1027
|
-
mock_send_dotdigital_email.assert_any_call(
|
|
1028
|
-
ANY, [self.teacher_user.email], personalization_values=ANY
|
|
1029
|
-
)
|
|
967
|
+
mock_send_dotdigital_email.assert_any_call(ANY, [self.teacher_user.email], personalization_values=ANY)
|
|
1030
968
|
|
|
1031
|
-
mock_send_dotdigital_email.assert_any_call(
|
|
1032
|
-
ANY, [self.indy_user.email], personalization_values=ANY
|
|
1033
|
-
)
|
|
969
|
+
mock_send_dotdigital_email.assert_any_call(ANY, [self.indy_user.email], personalization_values=ANY)
|
|
1034
970
|
|
|
1035
971
|
# Check only two emails are sent - the student should never be included.
|
|
1036
972
|
assert mock_send_dotdigital_email.call_count == 2
|
|
@@ -1040,40 +976,22 @@ class TestUser(CronTestCase):
|
|
|
1040
976
|
mock_send_dotdigital_email.reset_mock()
|
|
1041
977
|
|
|
1042
978
|
def test_first_verify_email_reminder_view(self):
|
|
1043
|
-
self.send_verify_email_reminder(
|
|
1044
|
-
|
|
1045
|
-
)
|
|
1046
|
-
self.send_verify_email_reminder(
|
|
1047
|
-
7, False, "first-verify-email-reminder", True
|
|
1048
|
-
)
|
|
1049
|
-
self.send_verify_email_reminder(
|
|
1050
|
-
7, True, "first-verify-email-reminder", False
|
|
1051
|
-
)
|
|
1052
|
-
self.send_verify_email_reminder(
|
|
1053
|
-
8, False, "first-verify-email-reminder", False
|
|
1054
|
-
)
|
|
979
|
+
self.send_verify_email_reminder(6, False, "first-verify-email-reminder", False)
|
|
980
|
+
self.send_verify_email_reminder(7, False, "first-verify-email-reminder", True)
|
|
981
|
+
self.send_verify_email_reminder(7, True, "first-verify-email-reminder", False)
|
|
982
|
+
self.send_verify_email_reminder(8, False, "first-verify-email-reminder", False)
|
|
1055
983
|
|
|
1056
984
|
def test_second_verify_email_reminder_view(self):
|
|
1057
|
-
self.send_verify_email_reminder(
|
|
1058
|
-
|
|
1059
|
-
)
|
|
1060
|
-
self.send_verify_email_reminder(
|
|
1061
|
-
14, False, "second-verify-email-reminder", True
|
|
1062
|
-
)
|
|
1063
|
-
self.send_verify_email_reminder(
|
|
1064
|
-
14, True, "second-verify-email-reminder", False
|
|
1065
|
-
)
|
|
1066
|
-
self.send_verify_email_reminder(
|
|
1067
|
-
15, False, "second-verify-email-reminder", False
|
|
1068
|
-
)
|
|
985
|
+
self.send_verify_email_reminder(13, False, "second-verify-email-reminder", False)
|
|
986
|
+
self.send_verify_email_reminder(14, False, "second-verify-email-reminder", True)
|
|
987
|
+
self.send_verify_email_reminder(14, True, "second-verify-email-reminder", False)
|
|
988
|
+
self.send_verify_email_reminder(15, False, "second-verify-email-reminder", False)
|
|
1069
989
|
|
|
1070
990
|
def test_anonymise_unverified_accounts_view(self):
|
|
1071
991
|
now = timezone.now()
|
|
1072
992
|
|
|
1073
993
|
for user in [self.teacher_user, self.indy_user, self.student_user]:
|
|
1074
|
-
user.date_joined = now - timedelta(
|
|
1075
|
-
days=USER_DELETE_UNVERIFIED_ACCOUNT_DAYS + 1
|
|
1076
|
-
)
|
|
994
|
+
user.date_joined = now - timedelta(days=USER_DELETE_UNVERIFIED_ACCOUNT_DAYS + 1)
|
|
1077
995
|
user.save()
|
|
1078
996
|
|
|
1079
997
|
for user_profile in [self.teacher_user_profile, self.indy_user_profile]:
|
|
@@ -1138,9 +1056,7 @@ class TestUser(CronTestCase):
|
|
|
1138
1056
|
new_user=indy_user,
|
|
1139
1057
|
)
|
|
1140
1058
|
|
|
1141
|
-
activity_today = DailyActivity.objects.get_or_create(
|
|
1142
|
-
date=datetime.now().date()
|
|
1143
|
-
)[0]
|
|
1059
|
+
activity_today = DailyActivity.objects.get_or_create(date=datetime.now().date())[0]
|
|
1144
1060
|
daily_teacher_count = activity_today.anonymised_unverified_teachers
|
|
1145
1061
|
daily_indy_count = activity_today.anonymised_unverified_independents
|
|
1146
1062
|
|
|
@@ -1163,30 +1079,16 @@ class TestUser(CronTestCase):
|
|
|
1163
1079
|
assert indy_user_active == assert_active
|
|
1164
1080
|
assert student_user_active
|
|
1165
1081
|
|
|
1166
|
-
activity_today = DailyActivity.objects.get_or_create(
|
|
1167
|
-
date=datetime.now().date()
|
|
1168
|
-
)[0]
|
|
1082
|
+
activity_today = DailyActivity.objects.get_or_create(date=datetime.now().date())[0]
|
|
1169
1083
|
total_activity = TotalActivity.objects.get(id=1)
|
|
1170
1084
|
|
|
1171
1085
|
if not teacher_user_active:
|
|
1172
|
-
assert
|
|
1173
|
-
|
|
1174
|
-
== daily_teacher_count + 1
|
|
1175
|
-
)
|
|
1176
|
-
assert (
|
|
1177
|
-
total_activity.anonymised_unverified_teachers
|
|
1178
|
-
== total_teacher_count + 1
|
|
1179
|
-
)
|
|
1086
|
+
assert activity_today.anonymised_unverified_teachers == daily_teacher_count + 1
|
|
1087
|
+
assert total_activity.anonymised_unverified_teachers == total_teacher_count + 1
|
|
1180
1088
|
|
|
1181
1089
|
if not indy_user_active:
|
|
1182
|
-
assert
|
|
1183
|
-
|
|
1184
|
-
== daily_indy_count + 1
|
|
1185
|
-
)
|
|
1186
|
-
assert (
|
|
1187
|
-
total_activity.anonymised_unverified_independents
|
|
1188
|
-
== total_indy_count + 1
|
|
1189
|
-
)
|
|
1090
|
+
assert activity_today.anonymised_unverified_independents == daily_indy_count + 1
|
|
1091
|
+
assert total_activity.anonymised_unverified_independents == total_indy_count + 1
|
|
1190
1092
|
|
|
1191
1093
|
teacher_user.delete()
|
|
1192
1094
|
indy_user.delete()
|
portal/urls.py
CHANGED
|
@@ -17,22 +17,16 @@ from two_factor.views import (
|
|
|
17
17
|
from portal.helpers.decorators import ratelimit
|
|
18
18
|
from portal.helpers.ratelimit import (
|
|
19
19
|
RATELIMIT_LOGIN_GROUP,
|
|
20
|
-
RATELIMIT_METHOD,
|
|
21
20
|
RATELIMIT_LOGIN_RATE,
|
|
22
21
|
RATELIMIT_LOGIN_RATE_SCHOOL_STUDENT,
|
|
22
|
+
RATELIMIT_METHOD,
|
|
23
|
+
school_student_key,
|
|
23
24
|
)
|
|
24
|
-
from portal.helpers.ratelimit import school_student_key
|
|
25
25
|
from portal.helpers.regexes import ACCESS_CODE_REGEX, JWT_REGEX
|
|
26
26
|
from portal.views import cron
|
|
27
|
-
from portal.views.about import about,
|
|
28
|
-
from portal.views.admin import
|
|
29
|
-
|
|
30
|
-
AdminChangePasswordView,
|
|
31
|
-
)
|
|
32
|
-
from portal.views.aimmo.dashboard import (
|
|
33
|
-
StudentAimmoDashboard,
|
|
34
|
-
TeacherAimmoDashboard,
|
|
35
|
-
)
|
|
27
|
+
from portal.views.about import about, contribute, getinvolved
|
|
28
|
+
from portal.views.admin import AdminChangePasswordDoneView, AdminChangePasswordView
|
|
29
|
+
from portal.views.aimmo.dashboard import StudentAimmoDashboard, TeacherAimmoDashboard
|
|
36
30
|
from portal.views.api import (
|
|
37
31
|
AnonymiseOrphanSchoolsView,
|
|
38
32
|
InactiveUsersView,
|
|
@@ -41,10 +35,7 @@ from portal.views.api import (
|
|
|
41
35
|
number_users_per_country,
|
|
42
36
|
registered_users,
|
|
43
37
|
)
|
|
44
|
-
from portal.views.dotmailer import
|
|
45
|
-
dotmailer_consent_form,
|
|
46
|
-
process_newsletter_form,
|
|
47
|
-
)
|
|
38
|
+
from portal.views.dotmailer import dotmailer_consent_form, process_newsletter_form
|
|
48
39
|
from portal.views.email import verify_email
|
|
49
40
|
from portal.views.home import (
|
|
50
41
|
coding_club,
|
|
@@ -54,53 +45,55 @@ from portal.views.home import (
|
|
|
54
45
|
logout_view,
|
|
55
46
|
register_view,
|
|
56
47
|
reset_screentime_warning,
|
|
48
|
+
ten_year_map_page,
|
|
57
49
|
)
|
|
58
50
|
from portal.views.legal import privacy_notice, terms
|
|
59
51
|
from portal.views.login import old_login_form_redirect
|
|
60
52
|
from portal.views.login.independent_student import IndependentStudentLoginView
|
|
61
53
|
from portal.views.login.student import (
|
|
62
|
-
StudentLoginView,
|
|
63
54
|
StudentClassCodeView,
|
|
55
|
+
StudentLoginView,
|
|
64
56
|
student_direct_login,
|
|
65
57
|
)
|
|
66
58
|
from portal.views.login.teacher import TeacherLoginView
|
|
67
59
|
from portal.views.organisation import organisation_leave, organisation_manage
|
|
68
60
|
from portal.views.play_landing_page import play_landing_page
|
|
69
61
|
from portal.views.registration import (
|
|
62
|
+
delete_account,
|
|
70
63
|
password_reset_check_and_confirm,
|
|
71
64
|
password_reset_done,
|
|
72
65
|
student_password_reset,
|
|
73
66
|
teacher_password_reset,
|
|
74
|
-
delete_account,
|
|
75
67
|
)
|
|
76
68
|
from portal.views.student.edit_account_details import (
|
|
77
|
-
independentStudentEditAccountView,
|
|
78
69
|
SchoolStudentEditAccountView,
|
|
70
|
+
independentStudentEditAccountView,
|
|
79
71
|
student_edit_account,
|
|
80
72
|
)
|
|
81
73
|
from portal.views.student.play import (
|
|
82
|
-
SchoolStudentDashboard,
|
|
83
74
|
IndependentStudentDashboard,
|
|
75
|
+
SchoolStudentDashboard,
|
|
84
76
|
student_join_organisation,
|
|
85
77
|
)
|
|
86
78
|
from portal.views.teach import teach
|
|
87
79
|
from portal.views.teacher.dashboard import (
|
|
88
80
|
dashboard_manage,
|
|
89
|
-
|
|
81
|
+
delete_teacher_invite,
|
|
90
82
|
invite_toggle_admin,
|
|
83
|
+
invited_teacher,
|
|
84
|
+
organisation_kick,
|
|
91
85
|
organisation_toggle_admin,
|
|
86
|
+
resend_invite_teacher,
|
|
92
87
|
teacher_accept_student_request,
|
|
93
88
|
teacher_disable_2FA,
|
|
94
89
|
teacher_reject_student_request,
|
|
95
|
-
delete_teacher_invite,
|
|
96
|
-
invited_teacher,
|
|
97
|
-
resend_invite_teacher,
|
|
98
90
|
)
|
|
99
91
|
from portal.views.teacher.teach import (
|
|
100
92
|
teacher_class_password_reset,
|
|
101
93
|
teacher_delete_class,
|
|
102
94
|
teacher_delete_students,
|
|
103
95
|
teacher_dismiss_students,
|
|
96
|
+
teacher_download_csv,
|
|
104
97
|
teacher_edit_class,
|
|
105
98
|
teacher_edit_student,
|
|
106
99
|
teacher_move_students,
|
|
@@ -108,7 +101,6 @@ from portal.views.teacher.teach import (
|
|
|
108
101
|
teacher_onboarding_create_class,
|
|
109
102
|
teacher_onboarding_edit_class,
|
|
110
103
|
teacher_print_reminder_cards,
|
|
111
|
-
teacher_download_csv,
|
|
112
104
|
teacher_view_class,
|
|
113
105
|
)
|
|
114
106
|
from portal.views.two_factor.core import CustomSetupView
|
|
@@ -117,9 +109,7 @@ from portal.views.two_factor.profile import CustomDisableView
|
|
|
117
109
|
js_info_dict = {"packages": ("conf.locale",)}
|
|
118
110
|
|
|
119
111
|
two_factor_patterns = [
|
|
120
|
-
url(
|
|
121
|
-
r"^account/two_factor/setup/$", CustomSetupView.as_view(), name="setup"
|
|
122
|
-
),
|
|
112
|
+
url(r"^account/two_factor/setup/$", CustomSetupView.as_view(), name="setup"),
|
|
123
113
|
url(r"^account/two_factor/qrcode/$", QRGeneratorView.as_view(), name="qr"),
|
|
124
114
|
url(
|
|
125
115
|
r"^account/two_factor/setup/complete/$",
|
|
@@ -187,9 +177,7 @@ urlpatterns = [
|
|
|
187
177
|
),
|
|
188
178
|
url(
|
|
189
179
|
r"^favicon\.ico$",
|
|
190
|
-
RedirectView.as_view(
|
|
191
|
-
url="/static/portal/img/favicon.ico", permanent=True
|
|
192
|
-
),
|
|
180
|
+
RedirectView.as_view(url="/static/portal/img/favicon.ico", permanent=True),
|
|
193
181
|
),
|
|
194
182
|
url(
|
|
195
183
|
r"^administration/password_change/$",
|
|
@@ -201,9 +189,7 @@ urlpatterns = [
|
|
|
201
189
|
AdminChangePasswordDoneView.as_view(),
|
|
202
190
|
name="administration_password_change_done",
|
|
203
191
|
),
|
|
204
|
-
url(
|
|
205
|
-
r"^users/inactive/", InactiveUsersView.as_view(), name="inactive_users"
|
|
206
|
-
),
|
|
192
|
+
url(r"^users/inactive/", InactiveUsersView.as_view(), name="inactive_users"),
|
|
207
193
|
url(
|
|
208
194
|
r"^locked_out/$",
|
|
209
195
|
TemplateView.as_view(template_name="portal/locked_out.html"),
|
|
@@ -281,9 +267,7 @@ urlpatterns = [
|
|
|
281
267
|
url(r"^consent_form/$", dotmailer_consent_form, name="consent_form"),
|
|
282
268
|
url(
|
|
283
269
|
r"^verify_email/$",
|
|
284
|
-
TemplateView.as_view(
|
|
285
|
-
template_name="portal/email_verification_needed.html"
|
|
286
|
-
),
|
|
270
|
+
TemplateView.as_view(template_name="portal/email_verification_needed.html"),
|
|
287
271
|
name="email_verification",
|
|
288
272
|
),
|
|
289
273
|
url(
|
|
@@ -396,9 +380,7 @@ urlpatterns = [
|
|
|
396
380
|
url(r"^contribute", contribute, name="contribute"),
|
|
397
381
|
url(r"^terms", terms, name="terms"),
|
|
398
382
|
url(r"^privacy-notice/$", privacy_notice, name="privacy_notice"),
|
|
399
|
-
url(
|
|
400
|
-
r"^privacy-policy/$", privacy_notice, name="privacy_policy"
|
|
401
|
-
), # Keeping this to route from old URL
|
|
383
|
+
url(r"^privacy-policy/$", privacy_notice, name="privacy_policy"), # Keeping this to route from old URL
|
|
402
384
|
url(r"^teach/dashboard/$", dashboard_manage, name="dashboard"),
|
|
403
385
|
url(
|
|
404
386
|
r"^teach/dashboard/kick/(?P<pk>[0-9]+)/$",
|
|
@@ -529,4 +511,5 @@ urlpatterns = [
|
|
|
529
511
|
RemoveFakeAccounts.as_view(),
|
|
530
512
|
name="remove_fake_accounts",
|
|
531
513
|
),
|
|
514
|
+
url(r"^celebrate/", ten_year_map_page, name="celebrate"),
|
|
532
515
|
]
|