Example #1
0
 def test_rfp_should_return_iterator(self):
     gpi = [{
         'slug': "slug1",
         'title': "title1",
         'date': util.random_date()
     }, {
         'slug': "slug2",
         'title': "title2",
         'date': util.random_date()
     }, {
         'slug': "slug3",
         'title': "title3",
         'date': util.random_date()
     }, {
         'slug': "slug4",
         'title': "title4",
         'date': util.random_date()
     }, {
         'slug': "slug5",
         'title': "title5",
         'date': util.random_date()
     }]
     r = self.site.renderfront_chronological_plain(gpi, 2)
     self.assertIsInstance(
         r, types.GeneratorType,
         "renderfront_chronological_page did not return an iterator.")
Example #2
0
 def test_rfp_should_return_iterator(self):
     gpi = [ { 'slug': "slug1", 'title': "title1", 'date': util.random_date()}, 
             { 'slug': "slug2", 'title': "title2", 'date': util.random_date()}, 
             { 'slug': "slug3", 'title': "title3", 'date': util.random_date()}, 
             { 'slug': "slug4", 'title': "title4", 'date': util.random_date()}, 
             { 'slug': "slug5", 'title': "title5", 'date': util.random_date()}
           ]
     r = self.site.renderfront_chronological_plain(gpi,2)
     self.assertIsInstance(r,types.GeneratorType,"renderfront_chronological_page did not return an iterator.")
Example #3
0
 def test_set_date_read_date_should_be_same_as_written_date(self):
     #need auxiliary callable to test setter
     d = util.random_date()
     self.p1.creation_date = d
     self.p1.write()
     p2 = s2page.Page(self.site,self.p1slug,isslug=True)
     self.assertEqual(p2.creation_date,d.isoformat(),"read date was not the same as written date.")
Example #4
0
 def test_set_date_read_date_should_be_same_as_written_date(self):
     #need auxiliary callable to test setter
     d = util.random_date()
     self.p1.creation_date = d
     self.p1.write()
     p2 = s2page.Page(self.site, self.p1slug, isslug=True)
     self.assertEqual(p2.creation_date, d.isoformat(),
                      "read date was not the same as written date.")
Example #5
0
 def setUp(self):
    # create fake tempdir with the structure
     self.temp_dir = tempfile.mkdtemp()
     self.site = s2site.Site(self.temp_dir)
     self.site.init_structure()
     self.ntg = random.randint(8,100)
     self.gpi= []
     for i in range(0,self.ntg):
         title = util.random_title()
         self.gpi.append( { 'slug': util.make_slug(title),
                       'title': title,
                       'date': util.random_date()}
                   )   
     self.epp = random.randint(5,self.ntg)
     self.correctnumpag = math.ceil(float(self.ntg)/self.epp)
Example #6
0
 def setUp(self):
     # create fake tempdir with the structure
     self.temp_dir = tempfile.mkdtemp()
     self.site = s2site.Site(self.temp_dir)
     self.site.init_structure()
     self.ntg = random.randint(8, 100)
     self.gpi = []
     for i in range(0, self.ntg):
         title = util.random_title()
         self.gpi.append({
             'slug': util.make_slug(title),
             'title': title,
             'date': util.random_date()
         })
     self.epp = random.randint(5, self.ntg)
     self.correctnumpag = math.ceil(float(self.ntg) / self.epp)