Kaydet (Commit) fbc467c2 authored tarafından Tim Graham's avatar Tim Graham

Moved contrib.sitemaps tests out of contrib.

üst d8341bf0
...@@ -30,6 +30,5 @@ recursive-include django/contrib/gis/tests/geoapp/fixtures * ...@@ -30,6 +30,5 @@ recursive-include django/contrib/gis/tests/geoapp/fixtures *
recursive-include django/contrib/gis/tests/geogapp/fixtures * recursive-include django/contrib/gis/tests/geogapp/fixtures *
recursive-include django/contrib/gis/tests/relatedapp/fixtures * recursive-include django/contrib/gis/tests/relatedapp/fixtures *
recursive-include django/contrib/sitemaps/templates * recursive-include django/contrib/sitemaps/templates *
recursive-include django/contrib/sitemaps/tests/templates *
recursive-exclude * __pycache__ recursive-exclude * __pycache__
recursive-exclude * *.py[co] recursive-exclude * *.py[co]
from django.apps import apps from django.apps import apps
from django.core.cache import cache from django.core.cache import cache
from django.core.urlresolvers import reverse from django.test import TestCase, modify_settings, override_settings
from django.db import models
from django.test import TestCase, override_settings
from .models import I18nTestModel, TestModel
class TestModel(models.Model):
name = models.CharField(max_length=100)
class Meta: @modify_settings(INSTALLED_APPS={'append': 'django.contrib.sitemaps'})
app_label = 'sitemaps' @override_settings(ROOT_URLCONF='sitemaps_tests.urls.http')
def __unicode__(self):
return self.name
def get_absolute_url(self):
return '/testmodel/%s/' % self.id
class I18nTestModel(models.Model):
name = models.CharField(max_length=100)
class Meta:
app_label = 'sitemaps'
def get_absolute_url(self):
return reverse('i18n_testmodel', args=[self.id])
@override_settings(ROOT_URLCONF='django.contrib.sitemaps.tests.urls.http')
class SitemapTestsBase(TestCase): class SitemapTestsBase(TestCase):
protocol = 'http' protocol = 'http'
sites_installed = apps.is_installed('django.contrib.sites') sites_installed = apps.is_installed('django.contrib.sites')
......
from django.core.urlresolvers import reverse
from django.db import models
class TestModel(models.Model):
name = models.CharField(max_length=100)
def get_absolute_url(self):
return '/testmodel/%s/' % self.id
class I18nTestModel(models.Model):
name = models.CharField(max_length=100)
def get_absolute_url(self):
return reverse('i18n_testmodel', args=[self.id])
...@@ -2,7 +2,8 @@ from __future__ import unicode_literals ...@@ -2,7 +2,8 @@ from __future__ import unicode_literals
from django.test import override_settings from django.test import override_settings
from .base import SitemapTestsBase, TestModel from .base import SitemapTestsBase
from .models import TestModel
@override_settings(ABSOLUTE_URL_OVERRIDES={}) @override_settings(ABSOLUTE_URL_OVERRIDES={})
......
...@@ -15,7 +15,8 @@ from django.utils.deprecation import RemovedInDjango20Warning ...@@ -15,7 +15,8 @@ from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.formats import localize from django.utils.formats import localize
from django.utils.translation import activate, deactivate from django.utils.translation import activate, deactivate
from .base import SitemapTestsBase, TestModel from .base import SitemapTestsBase
from .models import TestModel
class HTTPSitemapTests(SitemapTestsBase): class HTTPSitemapTests(SitemapTestsBase):
......
...@@ -8,7 +8,7 @@ from django.utils.deprecation import RemovedInDjango20Warning ...@@ -8,7 +8,7 @@ from django.utils.deprecation import RemovedInDjango20Warning
from .base import SitemapTestsBase from .base import SitemapTestsBase
@override_settings(ROOT_URLCONF='django.contrib.sitemaps.tests.urls.https') @override_settings(ROOT_URLCONF='sitemaps_tests.urls.https')
class HTTPSSitemapTests(SitemapTestsBase): class HTTPSSitemapTests(SitemapTestsBase):
protocol = 'https' protocol = 'https'
......
...@@ -3,11 +3,12 @@ from datetime import date, datetime ...@@ -3,11 +3,12 @@ from datetime import date, datetime
from django.conf.urls import url from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns from django.conf.urls.i18n import i18n_patterns
from django.contrib.sitemaps import GenericSitemap, Sitemap, views from django.contrib.sitemaps import GenericSitemap, Sitemap, views
from django.contrib.sitemaps.tests.base import I18nTestModel, TestModel
from django.http import HttpResponse from django.http import HttpResponse
from django.utils import timezone from django.utils import timezone
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
from ..models import I18nTestModel, TestModel
class SimpleSitemap(Sitemap): class SimpleSitemap(Sitemap):
changefreq = "never" changefreq = "never"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment