<commit_before>from django.contrib.auth.models import User
from django.shortcuts import reverse
from django.test import Client

import pytest


@pytest.mark.django_db
@pytest.mark.parametrize('view_name', [
    'person-list',
    'missing_doc',
])
def test_list_views(logged_client, view_name):
    url = reverse(view_name)
    response = logged_client.get(url)
    assert response.status_code == 200


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/login/',
    '/webapp/home/',
    '/webapp/membership/',
    '/webapp/basicformnewperson/',
    '/webapp/basicformnewfamily/',
    '/webapp/person/',
])
def test_views_exist(logged_client, url):
    response = logged_client.get(url)
    assert response.status_code == 200


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/person/new/',
])
def test_create_person(logged_client, url):
    data = {'name': 'Juan', 'surname': 'Bosco'}
    response = logged_client.post(url, data=data)
    assert response.status_code == 302


@pytest.mark.django_db
@pytest.mark.parametrize('url, data', [
    ('/webapp/person/{pk}/volunteer/', {}),
])
def test_create_from_person(logged_client, person, url, data):
    # Inject person UID to POST data
    data['person'] = person.pk
    response = logged_client.post(url.format(pk=person.id), data=data)
    assert response.status_code == 302


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/login/',
])<commit_msg>Añade test edición persona<commit_after>from django.contrib.auth.models import User
from django.shortcuts import reverse
from django.test import Client

import pytest


@pytest.mark.django_db
@pytest.mark.parametrize('view_name', [
    'person-list',
    'missing_doc',
])
def test_list_views(logged_client, view_name):
    url = reverse(view_name)
    response = logged_client.get(url)
    assert response.status_code == 200


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/login/',
    '/webapp/home/',
    '/webapp/membership/',
    '/webapp/basicformnewperson/',
    '/webapp/basicformnewfamily/',
    '/webapp/person/',
])
def test_views_exist(logged_client, url):
    response = logged_client.get(url)
    assert response.status_code == 200


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/person/new/',
])
def test_create_person(logged_client, url):
    data = {'name': 'Juan', 'surname': 'Bosco'}
    response = logged_client.post(url, data=data)
    assert response.status_code == 302


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/person/{}/edit/',
])
def test_edit_person(logged_client, person, url):
    data = {'name': 'Juan', 'surname': 'Bosco'}
    response = logged_client.post(url.format(person.id), data=data)
    assert response.status_code == 302


@pytest.mark.django_db
@pytest.mark.parametrize('url, data', [
    ('/webapp/person/{pk}/volunteer/', {}),
])
def test_create_from_person(logged_client, person, url, data):
    # Inject person UID to POST data
    data['person'] = person.pk
    response = logged_client.post(url.format(pk=person.id), data=data)
    assert response.status_code == 302


@pytest.mark.django_db
@pytest.mark.parametrize('url', [
    '/webapp/login/',
])
{'fraction_non_alphanumeric': 0.15539079394501082, 'fraction_numerical': 0.008341056533827619, 'mean_word_length': 4.2564935064935066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1751831', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1175, 'n_words': 195}