def test_38_get_scenario_with_images(client, default_hearing): """ Check images exist in scenario payloads """ data = get_data_from_response(client.get(get_hearing_detail_url(default_hearing.id, 'scenarios'))) first_scenario = data[0] check_entity_images(first_scenario)
def test_comment_edit_versioning(john_doe_api_client, random_hearing): response = john_doe_api_client.post('/v1/hearing/%s/comments/' % random_hearing.pk, data={ "content": "THIS SERVICE SUCKS" }) data = get_data_from_response(response, 201) comment_id = data["id"] comment = HearingComment.objects.get(pk=comment_id) assert comment.content.isupper() # Oh my, all that screaming :( assert not reversion.get_for_object(comment) # No revisions response = john_doe_api_client.patch('/v1/hearing/%s/comments/%s/' % (random_hearing.pk, comment_id), data={ "content": "Never mind, it's nice :)" }) data = get_data_from_response(response, 200) comment = HearingComment.objects.get(pk=comment_id) assert not comment.content.isupper() # Screaming is gone assert len(reversion.get_for_object(comment)) == 1 # One old revision
def test_38_get_hearing_check_scenario_with_images(client, default_hearing): """ Check images exist in scenarios nested in hearing payloads """ data = get_data_from_response(client.get(get_hearing_detail_url(default_hearing.id))) assert 'scenarios' in data first_scenario = data['scenarios'][0] check_entity_images(first_scenario)
def test_37_list_hearing_images_check_titles(client, default_hearing): """ Check images exist in hearing image payloads """ data = get_data_from_response(client.get(get_hearing_detail_url(default_hearing.id, 'images'))) check_entity_images({"images": data})
def test_8_list_hearing_images(client, default_hearing): data = get_data_from_response(client.get(get_hearing_detail_url(default_hearing.id))) check_entity_images(data)