@@ -50,7 +50,9 @@ def test_amplitude_create_list__valid_key__creates_amplitude_cohort(
5050
5151 # Then
5252 assert response .status_code == status .HTTP_200_OK
53- cohort = Cohort .objects .get (uuid = response .json ()["listId" ])
53+ cohort = Cohort .objects .get (uuid = response .json ()["list_id" ])
54+ # Amplitude's Testing tab reads the flat copy, production the nested one.
55+ assert response .json ()["response" ]["list_id" ] == response .json ()["list_id" ]
5456 assert cohort .environment == key .environment
5557 assert cohort .source_type == CohortSourceType .AMPLITUDE
5658 assert cohort .segment .name == "[Amplitude] Beta users: 1234"
@@ -74,7 +76,7 @@ def test_amplitude_create_list__postgres_environment__creates_cohort(
7476
7577 # Then
7678 assert response .status_code == status .HTTP_200_OK
77- cohort = Cohort .objects .get (uuid = response .json ()["listId " ])
79+ cohort = Cohort .objects .get (uuid = response .json ()["list_id " ])
7880 assert cohort .environment == environment
7981
8082
@@ -350,7 +352,7 @@ def test_amplitude_create_list__valid_key__audits_and_queues_environment_update(
350352 # Then - the audit record carries no user, names the source, and is the
351353 # hook that rebuilds the environment document.
352354 assert response .status_code == status .HTTP_200_OK
353- cohort = Cohort .objects .get (uuid = response .json ()["listId " ])
355+ cohort = Cohort .objects .get (uuid = response .json ()["list_id " ])
354356 audit_log = AuditLog .objects .get (related_object_id = cohort .segment_id )
355357 assert audit_log .author is None
356358 assert audit_log .master_api_key is None
@@ -377,7 +379,7 @@ def test_amplitude_create_list__valid_key__history_records_no_user(
377379 # Then - a machine caller leaves no user on historical records; stamping
378380 # one would fail, since the sync key is not a Flagsmith user.
379381 assert response .status_code == status .HTTP_200_OK
380- cohort = Cohort .objects .get (uuid = response .json ()["listId " ])
382+ cohort = Cohort .objects .get (uuid = response .json ()["list_id " ])
381383 history_record = cohort .segment .history .get ()
382384 assert history_record .history_user is None
383385 assert history_record .master_api_key is None
0 commit comments