def test_feed_pubdate_returns_job_created_at(self): feed_pubdate = JobsFeed.item_pubdate(self, self.job) self.assertEquals(feed_pubdate, self.job.created_at)
def test_feed_link_returns_job_link(self): job_link = reverse('job-show', args=[self.job.pk]) self.assertEquals(JobsFeed.item_link(self, self.job), job_link)
def test_feed_author_name_returns_job_pythonjobs_ie(self): feed_author = JobsFeed.item_author_name(self, self.job) self.assertEquals(feed_author, 'pythonjobs.ie')
def test_feed_description_returns_job_description(self): feed_description = JobsFeed.item_description(self, self.job) self.assertEquals(feed_description, self.job.description)
def test_feed_title_returns_job_position(self): item = self.job self.assertEquals(JobsFeed.item_title(self, item), item.position)
def test_feed_items_returns_not_empty_list(self): self.assertNotEqual(len(JobsFeed.items(self)), 0)
from django.views.generic import TemplateView from django.contrib.sitemaps.views import sitemap from django.contrib.sitemaps import GenericSitemap from jobs.views import IndexView, ShowView, NewView, EditView, JobsFeed from .models import Job info_job = { 'queryset': Job.get_actives(), 'data_field': 'modified_at', } urlpatterns = [ url(r'^jobs/new$', NewView.as_view(), name='job-new'), url(r'^jobs/(?P<pk>[0-9]+)/$', ShowView.as_view(), name='job-show'), url(r'^jobs/edit/(?P<slug>[A-Z0-9]+)$', EditView.as_view(slug_field="token"), name='job-edit'), url(r'^$', IndexView.as_view(), name='job-home'), url(r'^rss/$', JobsFeed()), url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain'), name="robots"), url(r'^sitemap\.xml$', sitemap, {'sitemaps': { 'jobs': GenericSitemap(info_job, priority=0.6) }}, name='django.contrib.sitemaps.views.sitemap'), ]