Skip to content

Commit 95ecfa1

Browse files
committed
deps: upgrade to django 5.2 and all applicable deps
Refs: KK-1467
1 parent 5f994d6 commit 95ecfa1

13 files changed

Lines changed: 1372 additions & 1051 deletions

File tree

children/factories.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import factory
22

33
from children.models import Child, Relationship
4+
from common.mixins import SaveAfterPostGenerationMixin
45
from projects.models import Project
56
from users.factories import GuardianFactory
67

@@ -39,10 +40,19 @@ class Meta:
3940
skip_postgeneration_save = True # Not needed after factory v4.0.0
4041

4142

42-
class ChildWithGuardianFactory(ChildFactory):
43-
relationship = factory.RelatedFactory(RelationshipFactory, "child")
43+
class ChildWithGuardianFactory(SaveAfterPostGenerationMixin, ChildFactory):
4444
project = factory.LazyFunction(lambda: Project.objects.get(year=2020))
4545

46+
@factory.post_generation
47+
def relationship(self, created, extracted, **kwargs):
48+
"""Create a relationship with a guardian after the child is created."""
49+
if created:
50+
RelationshipFactory(child=self, **kwargs)
51+
4652

4753
class ChildWithTwoGuardiansFactory(ChildWithGuardianFactory):
48-
relationship2 = factory.RelatedFactory(RelationshipFactory, "child")
54+
@factory.post_generation
55+
def relationship2(self, created, extracted, **kwargs):
56+
"""Create a second relationship with a guardian after the child is created."""
57+
if created:
58+
RelationshipFactory(child=self, **kwargs)

children/tests/__snapshots__/test_api.ambr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,12 @@
481481
'edges': list([
482482
dict({
483483
'node': dict({
484-
'remainingCapacity': 12,
484+
'remainingCapacity': 29,
485485
}),
486486
}),
487487
dict({
488488
'node': dict({
489-
'remainingCapacity': 13,
489+
'remainingCapacity': 30,
490490
}),
491491
}),
492492
]),
@@ -914,7 +914,7 @@
914914
'data': dict({
915915
'updateChild': dict({
916916
'child': dict({
917-
'birthyear': 2021,
917+
'birthyear': 2023,
918918
'name': 'Matti',
919919
'postalCode': '00840',
920920
}),
@@ -927,9 +927,9 @@
927927
'data': dict({
928928
'updateChild': dict({
929929
'child': dict({
930-
'birthyear': 2021,
931-
'name': 'Derek Perry',
932-
'postalCode': '70117',
930+
'birthyear': 2023,
931+
'name': 'Katherine Gomez',
932+
'postalCode': '49763',
933933
}),
934934
}),
935935
}),

common/tests/conftest.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
from graphene.test import Client
1313
from guardian.shortcuts import assign_perm
1414

15-
from children.factories import ChildWithGuardianFactory
15+
from children.factories import (
16+
ChildWithGuardianFactory,
17+
)
1618
from common.notification_service import SMSNotificationService
1719
from events.factories import EventFactory, EventGroupFactory, OccurrenceFactory
1820
from kukkuu.schema import schema
@@ -105,7 +107,8 @@ def user_api_client():
105107

106108
@pytest.fixture
107109
def guardian_api_client():
108-
return create_api_client_with_user(UserFactory(guardian=GuardianFactory()))
110+
guardian = GuardianFactory()
111+
return create_api_client_with_user(guardian.user)
109112

110113

111114
def _projects_user_api_client(
@@ -182,7 +185,8 @@ def child_with_random_guardian(project):
182185
@pytest.fixture
183186
def child_with_user_guardian(guardian_api_client, project):
184187
return ChildWithGuardianFactory(
185-
relationship__guardian__user=guardian_api_client.user, project=project
188+
relationship__guardian=guardian_api_client.user.guardian,
189+
project=project,
186190
)
187191

188192

events/tests/__snapshots__/test_api.ambr

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
'enrolOccurrence': dict({
152152
'enrolment': dict({
153153
'child': dict({
154-
'name': 'Derek Perry',
154+
'name': 'Katherine Gomez',
155155
}),
156156
'createdAt': '2020-12-12T00:00:00+00:00',
157157
'occurrence': dict({
@@ -186,7 +186,7 @@
186186
'enrolOccurrence': dict({
187187
'enrolment': dict({
188188
'child': dict({
189-
'name': 'Derek Perry',
189+
'name': 'Katherine Gomez',
190190
}),
191191
'createdAt': '2020-11-11T00:00:00+00:00',
192192
'occurrence': dict({
@@ -203,7 +203,7 @@
203203
'enrolOccurrence': dict({
204204
'enrolment': dict({
205205
'child': dict({
206-
'name': 'Derek Perry',
206+
'name': 'Katherine Gomez',
207207
}),
208208
'createdAt': '2020-11-11T00:00:00+00:00',
209209
'occurrence': dict({
@@ -220,7 +220,7 @@
220220
'enrolOccurrence': dict({
221221
'enrolment': dict({
222222
'child': dict({
223-
'name': 'Derek Perry',
223+
'name': 'Katherine Gomez',
224224
}),
225225
'createdAt': '2020-11-11T00:00:00+00:00',
226226
'occurrence': dict({
@@ -237,7 +237,7 @@
237237
'enrolOccurrence': dict({
238238
'enrolment': dict({
239239
'child': dict({
240-
'name': 'Derek Perry',
240+
'name': 'Katherine Gomez',
241241
}),
242242
'createdAt': '2020-11-11T00:00:00+00:00',
243243
'occurrence': dict({
@@ -254,7 +254,7 @@
254254
'enrolOccurrence': dict({
255255
'enrolment': dict({
256256
'child': dict({
257-
'name': 'Sandra Brown',
257+
'name': 'Sandra Hudson',
258258
}),
259259
'createdAt': '2020-12-12T00:00:00+00:00',
260260
'occurrence': dict({
@@ -275,56 +275,58 @@
275275
dict({
276276
'node': dict({
277277
'child': dict({
278-
'name': 'Sandra Brown',
278+
'name': 'Sandra Hudson',
279279
}),
280280
}),
281281
}),
282282
]),
283283
}),
284284
'event': dict({
285-
'capacityPerOccurrence': 25,
285+
'capacityPerOccurrence': 9,
286286
'duration': 1,
287-
'image': 'http://testserver/media/series.jpg',
288-
'participantsPerInvite': 'CHILD_AND_1_OR_2_GUARDIANS',
287+
'image': 'http://testserver/media/law.jpg',
288+
'participantsPerInvite': 'FAMILY',
289289
'publishedAt': '2020-12-12T00:00:00+00:00',
290290
'translations': list([
291291
dict({
292-
'description': 'Law ago respond yard door indicate country. Direction traditional whether serious sister work. Beat pressure unit toward movie by.',
292+
'description': 'Able last in able local. Quite nearly gun two born land. Yeah trouble method yard campaign former model.',
293293
'languageCode': 'FI',
294-
'name': 'Detail audience campaign college career fight data.',
295-
'shortDescription': 'Last in able local garden modern they.',
294+
'name': 'Always sport return student light a point.',
295+
'shortDescription': 'Who Mrs public east site chance.',
296296
}),
297297
]),
298298
}),
299299
'occurrenceLanguage': 'FI',
300-
'remainingCapacity': 21,
300+
'remainingCapacity': 5,
301301
'ticketSystem': dict({
302302
'type': 'INTERNAL',
303303
}),
304304
'time': '2020-12-12T00:00:00+00:00',
305305
'venue': dict({
306306
'translations': list([
307307
dict({
308-
'accessibilityInfo': 'Moment strong hand push book and interesting sit. Near increase process truth list pressure. Capital city sing himself yard stuff.',
308+
'accessibilityInfo': 'Daughter order stay sign discover. Analysis season project executive entire. Service wonder everything pay parent theory.',
309309
'additionalInfo': '''
310-
Sense person the probably. Simply state social believe policy. Score think turn argue present.
311-
Prevent pressure point. Voice radio happen color scene.
310+
Local challenge box myself last.
311+
Experience seven Republican throw wrong party wall.
312+
Policy data control as receive.
313+
Teacher subject family around year. Space speak sense person the probably deep.
312314
''',
313315
'address': '''
314-
404 Figueroa Trace
315-
Pollardview, GA 81371
316+
19054 Harold Mountains
317+
Bakerland, MS 59687
316318
''',
317319
'arrivalInstructions': '''
318-
Water those notice medical science sort. Front affect senior. Mission network who think significant land especially.
319-
Staff read rule point leg within. Staff country actually generation five training.
320+
Election stay every something base. Treat final central situation past ready join.
321+
Office water those notice medical. Already name likely behind mission network.
320322
''',
321323
'description': '''
322-
Page box child care any concern. Defense level church use.
323-
Never news behind. Beat at success decade either enter everything. Newspaper force newspaper business himself exist.
324+
Serious listen police shake. Page box child care any concern.
325+
Agree room laugh prevent make. Our very television beat at success decade.
324326
''',
325327
'languageCode': 'FI',
326-
'name': 'Dog hospital number.',
327-
'wwwUrl': 'https://www.beck-sherman.com/',
328+
'name': 'South among score fall long respond draw.',
329+
'wwwUrl': 'http://www.brooks.com/',
328330
}),
329331
]),
330332
}),
@@ -415,7 +417,7 @@
415417
'edges': list([
416418
dict({
417419
'node': dict({
418-
'name': 'Election stay every something base.',
420+
'name': 'Sit future dream party door better performance.',
419421
}),
420422
}),
421423
dict({

events/tests/__snapshots__/test_notifications.ambr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@
224224
# name: test_unenrol_occurrence_notification
225225
list([
226226
'''
227-
kukkuu@example.com|['pjenkins@example.net']|Occurrence unenrolment FI|
228-
Event FI: Detail audience campaign college career fight data.
229-
Guardian FI: Calvin Gutierrez (pjenkins@example.net)
227+
kukkuu@example.com|['michellewalker@example.net']|Occurrence unenrolment FI|
228+
Event FI: Always sport return student light a point.
229+
Guardian FI: Michael Patton (michellewalker@example.net)
230230
Occurrence: 2020-12-12 00:00:00+00:00
231-
Child: Sandra Brown (2023)
231+
Child: Sandra Hudson (2023)
232232
Unsubscribe: http://localhost:3000/fi/profile/subscriptions?authToken=a1b2c3d4e5f6g7h8
233233
''',
234234
])

events/tests/test_api.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
from projects.factories import ProjectFactory
9999
from projects.models import Project
100100
from subscriptions.factories import FreeSpotNotificationSubscriptionFactory
101-
from users.factories import GuardianFactory, UserFactory
101+
from users.factories import GuardianFactory
102102
from venues.factories import VenueFactory
103103

104104

@@ -1530,7 +1530,7 @@ def test_child_enrol_occurrence_from_different_project(
15301530
)
15311531
def test_api_query_depth(settings, event, max_query_depth, expected_error_message):
15321532
settings.KUKKUU_QUERY_MAX_DEPTH = max_query_depth
1533-
user = UserFactory(guardian=GuardianFactory())
1533+
user = GuardianFactory().user
15341534
request = RequestFactory().post("/graphql")
15351535
request.user = user
15361536

@@ -2001,7 +2001,7 @@ def test_event_group_events_filtering_by_available_for_child_id(
20012001
snapshot, guardian_api_client, user_api_client, event_group, past, future
20022002
):
20032003
child_with_guardian = ChildWithGuardianFactory(
2004-
relationship__guardian__user=guardian_api_client.user
2004+
relationship__guardian=guardian_api_client.user.guardian
20052005
)
20062006
OccurrenceFactory(
20072007
time=past, event__published_at=past, event__event_group=event_group
@@ -2061,7 +2061,7 @@ def test_event_ticket_system_password_own_child_password_exists(
20612061
):
20622062
event = EventFactory(ticket_system=Event.TICKETMASTER, published_at=now())
20632063
child = ChildWithGuardianFactory(
2064-
relationship__guardian__user=guardian_api_client.user.guardian.user
2064+
relationship__guardian=guardian_api_client.user.guardian
20652065
)
20662066
existing_password = TicketSystemPasswordFactory(
20672067
event=event, child=child, value="the correct password"
@@ -2081,7 +2081,7 @@ def test_event_ticket_system_password_own_child_password_exists(
20812081
def test_event_ticket_system_password_own_child_no_password(guardian_api_client):
20822082
event = EventFactory(ticket_system=Event.TICKETMASTER, published_at=now())
20832083
child = ChildWithGuardianFactory(
2084-
relationship__guardian__user=guardian_api_client.user.guardian.user
2084+
relationship__guardian=guardian_api_client.user.guardian
20852085
)
20862086

20872087
variables = {"eventId": get_global_id(event), "childId": get_global_id(child)}
@@ -2353,7 +2353,7 @@ def test_assign_ticket_system_password_success(guardian_api_client):
23532353
)
23542354
child = ChildWithGuardianFactory(
23552355
name="Test child",
2356-
relationship__guardian__user=guardian_api_client.user.guardian.user,
2356+
relationship__guardian=guardian_api_client.user.guardian,
23572357
)
23582358
someone_elses_password = TicketSystemPasswordFactory( # noqa: F841
23592359
event=event, value="FATAL LEAK", assigned_at=now()
@@ -2386,7 +2386,7 @@ def test_assign_ticket_system_password_already_assigned(guardian_api_client):
23862386
"""
23872387
event = EventFactory(ticket_system=Event.TICKETMASTER, published_at=now())
23882388
child = ChildWithGuardianFactory(
2389-
relationship__guardian__user=guardian_api_client.user.guardian.user
2389+
relationship__guardian=guardian_api_client.user.guardian
23902390
)
23912391
used_password = TicketSystemPasswordFactory(
23922392
event=event, child=child, value="Used password"
@@ -2410,7 +2410,7 @@ def test_assign_ticket_system_password_no_free_passwords(
24102410
"""
24112411
event = EventFactory(ticket_system=Event.TICKETMASTER, published_at=now())
24122412
child = ChildWithGuardianFactory(
2413-
relationship__guardian__user=guardian_api_client.user.guardian.user
2413+
relationship__guardian=guardian_api_client.user.guardian
24142414
)
24152415
TicketSystemPasswordFactory(
24162416
event=event, value="Someone else's password", assigned_at=now()
@@ -2427,7 +2427,7 @@ def test_assign_ticket_system_password_internal_event(guardian_api_client):
24272427
"""
24282428
event = EventFactory(ticket_system=Event.INTERNAL, published_at=now())
24292429
child = ChildWithGuardianFactory(
2430-
relationship__guardian__user=guardian_api_client.user.guardian.user
2430+
relationship__guardian=guardian_api_client.user.guardian
24312431
)
24322432

24332433
executed = _assign_ticket_system_password(guardian_api_client, event, child)
@@ -2445,7 +2445,7 @@ def test_assign_ticket_system_password_not_published_event(guardian_api_client):
24452445
"""
24462446
event = EventFactory(ticket_system=Event.TICKETMASTER, published_at=None)
24472447
child = ChildWithGuardianFactory(
2448-
relationship__guardian__user=guardian_api_client.user.guardian.user
2448+
relationship__guardian=guardian_api_client.user.guardian
24492449
)
24502450

24512451
executed = _assign_ticket_system_password(guardian_api_client, event, child)
@@ -2470,7 +2470,7 @@ def _create_data_for_ticket_system_password_only_externals_enrolment_limit_tests
24702470
child = ChildWithGuardianFactory(
24712471
name="Test child",
24722472
project=project,
2473-
relationship__guardian__user=client.user.guardian.user,
2473+
relationship__guardian=client.user.guardian,
24742474
)
24752475
TicketSystemPasswordFactory.create_batch(
24762476
size=existing_enrolment_count,
@@ -2579,7 +2579,7 @@ def test_assign_ticket_system_password_internal_and_external_enrolment_limit(
25792579
child = ChildWithGuardianFactory(
25802580
name="Test child",
25812581
project=project,
2582-
relationship__guardian__user=guardian_api_client.user.guardian.user,
2582+
relationship__guardian=guardian_api_client.user.guardian,
25832583
)
25842584
TicketSystemPasswordFactory(
25852585
child=child,

events/tests/test_notifications.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def test_unenrol_occurrence_notification(
357357
):
358358
settings.KUKKUU_ENROLMENT_UNENROL_HOURS_BEFORE = 0
359359
child = ChildWithGuardianFactory(
360-
relationship__guardian__user=guardian_api_client.user,
360+
relationship__guardian=guardian_api_client.user.guardian,
361361
project=project,
362362
)
363363
EnrolmentFactory(occurrence=occurrence, child=child)

0 commit comments

Comments
 (0)