def test_get_n_posts_returns_n_job_listings_for_m_month(self):
        
        job1 = JobListing.objects.create(jobid=1,
                                         title='Title 1',
                                         description='Description 1',
                                         added=datetime.datetime(2015, 8, 1).date())
        job2 = JobListing.objects.create(jobid=2,
                                         title='Title 2',
                                         description='Description 2',
                                         added=datetime.datetime(2015, 9, 2).date())
        job3 = JobListing.objects.create(jobid=3,
                                         title='Title 3',
                                         description='Description 3',
                                         added=datetime.datetime(2015, 9, 2).date())

        n_posts = JobListing.get_n_posts(datetime.datetime(2015, 9, 1).date(), month=True)
        self.assertEqual(n_posts, 2)
        n_posts = JobListing.get_n_posts(datetime.datetime(2015, 8, 1).date(), month=True)
        self.assertEqual(n_posts, 1)
Beispiel #2
0
 def create(cls, date):
     n_posts = JobListing.get_n_posts(date)
     daily_summary = cls(date=date, n_posts=n_posts)
     return daily_summary
Beispiel #3
0
 def create(cls, date):
     n_posts = JobListing.get_n_posts(date, month=True)
     monthly_summary = cls(date=date, n_posts=n_posts)
     return monthly_summary