<commit_before>import pytest

from django.core.urlresolvers import reverse

from name.models import Name, Location

pytestmark = pytest.mark.django_db


def test_feed_has_georss_namespace(client):
    response = client.get(reverse('name_feed'))
    assert 'xmlns:georss' in response.content


def test_feed_response_is_application_xml(client):
    response = client.get(reverse('name_feed'))
    assert response['Content-Type'] == 'application/xml'


def test_feed_item_has_location(client):
    name = Name.objects.create(name="Test", name_type=0)

    Location.objects.create(
        status=0,
        latitude=33.210241,
        longitude=-97.148857,
        belong_to_name=name)

    response = client.get(reverse('name_feed'))
    assert name.location_set.current_location.geo_point() in response.content
<commit_msg>Test the feed using the request factory instead of the client.<commit_after>import pytest

from django.core.urlresolvers import reverse

from name.feeds import NameAtomFeed
from name.models import Name, Location

pytestmark = pytest.mark.django_db


def test_feed_has_georss_namespace(rf):
    request = rf.get(reverse('name_feed'))
    feed = NameAtomFeed()
    response = feed(request)
    assert 'xmlns:georss' in response.content


def test_feed_response_is_application_xml(rf):
    request = rf.get(reverse('name_feed'))
    feed = NameAtomFeed()
    response = feed(request)
    assert response['Content-Type'] == 'application/xml'


def test_feed_item_has_location(rf):
    name = Name.objects.create(name="Test", name_type=0)

    Location.objects.create(
        status=0,
        latitude=33.210241,
        longitude=-97.148857,
        belong_to_name=name)

    request = rf.get(reverse('name_feed'))
    feed = NameAtomFeed()
    response = feed(request)

    assert name.location_set.current_location.geo_point() in response.content

{'fraction_non_alphanumeric': 0.10374331550802139, 'fraction_numerical': 0.019251336898395723, 'mean_word_length': 4.285310734463277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6158938', 'n_tokens_mistral': 617, 'n_tokens_neox': 595, 'n_words': 114}