예제 #1
0
 def test_created_timestamp(self):
     self._generate()
     r = self.client.get(urlparams(self.url, sort='created'))
     items = pq(r.content)('.primary .item')
     for idx, c in enumerate(r.context['pager'].object_list):
         assert trim_whitespace(items.eq(idx).find('.modified').text()) == (
             'Added %s' % trim_whitespace(datetime_filter(c.created)))
예제 #2
0
 def test_updated_timestamp(self):
     self._generate()
     r = self.client.get(urlparams(self.url, sort='updated'))
     items = pq(r.content)('.primary .item')
     for idx, c in enumerate(r.context['pager'].object_list):
         eq_(strip_whitespace(items.eq(idx).find('.modified').text()),
             'Updated %s' % strip_whitespace(datetime_filter(c.modified)))
예제 #3
0
 def test_updated_timestamp(self):
     self._generate()
     r = self.client.get(urlparams(self.url, sort='updated'))
     items = pq(r.content)('.primary .item')
     for idx, c in enumerate(r.context['pager'].object_list):
         eq_(strip_whitespace(items.eq(idx).find('.modified').text()),
             'Updated %s' % strip_whitespace(datetime_filter(c.modified)))
예제 #4
0
 def test_created_timestamp(self):
     self._generate()
     r = self.client.get(urlparams(self.url, sort='created'))
     items = pq(r.content)('.primary .item')
     for idx, c in enumerate(r.context['pager'].object_list):
         assert trim_whitespace(items.eq(idx).find('.modified').text()) == (
             'Added %s' % trim_whitespace(datetime_filter(c.created)))
예제 #5
0
 def test_purchase_date(self):
     # Some date that's not the same as the contribution.
     self.app.update(created=datetime(2011, 10, 15))
     res = self.client.get(self.url)
     eq_(res.status_code, 200)
     node = pq(res.content)('.purchase').eq(0).text()
     ts = datetime_filter(self.con.created)
     assert ts in node, '%s not found' % ts
예제 #6
0
 def test_purchase_date(self):
     # Some date that's not the same as the contribution.
     self.app.update(created=datetime(2011, 10, 15))
     res = self.client.get(self.url)
     eq_(res.status_code, 200)
     node = pq(res.content)('.purchase').eq(0).text()
     ts = datetime_filter(self.con.created)
     assert ts in node, '%s not found' % ts
예제 #7
0
파일: tests.py 프로젝트: PinZhang/zamboni
 def test_updated_date(self):
     doc = pq(self.client.get(urlparams(self.url, sort='updated')).content)
     for item in doc('.items .item'):
         item = pq(item)
         addon_id = item('.install').attr('data-addon')
         ts = Addon.objects.get(id=addon_id).last_updated
         eq_(item('.updated').text(),
             'Updated %s' % strip_whitespace(datetime_filter(ts)))
예제 #8
0
 def test_updated_date(self):
     doc = pq(self.client.get(urlparams(self.url, sort='updated')).content)
     for item in doc('.items .item'):
         item = pq(item)
         addon_id = item('.install').attr('data-addon')
         ts = Addon.objects.get(id=addon_id).last_updated
         assert item('.updated').text() == (
             u'Updated %s' % trim_whitespace(datetime_filter(ts)))
예제 #9
0
 def test_updated_timestamp(self):
     self._generate()
     r = self.client.get(urlparams(self.url, sort="updated"))
     items = pq(r.content)(".primary .item")
     for idx, c in enumerate(r.context["pager"].object_list):
         eq_(
             strip_whitespace(items.eq(idx).find(".modified").text()),
             "Updated %s" % strip_whitespace(datetime_filter(c.modified)),
         )
예제 #10
0
    def test_created_not_updated(self):
        """Don't display the updated date but the created date for themes."""
        r = self.client.get(self.url)
        doc = pq(r.content)
        details = doc('.addon-info li')

        # There's no "Last Updated" entry.
        assert not any('Last Updated' in node.text_content()
                       for node in details)

        # But there's a "Created" entry.
        for detail in details:
            if detail.find('h3').text_content() == 'Created':
                created = detail.find('p').text_content()
                eq_(created,
                    strip_whitespace(datetime_filter(self.addon.created)))
                break  # Needed, or we go in the "else" clause.
        else:
            assert False, 'No "Created" entry found.'
예제 #11
0
    def test_created_not_updated(self):
        """Don't display the updated date but the created date for themes."""
        r = self.client.get(self.url)
        doc = pq(r.content)
        details = doc('.addon-info li')

        # There's no "Last Updated" entry.
        assert not any('Last Updated' in node.text_content()
                       for node in details)

        # But there's a "Created" entry.
        for detail in details:
            if detail.find('h3').text_content() == 'Created':
                created = detail.find('p').text_content()
                assert created == (
                    trim_whitespace(datetime_filter(self.addon.created)))
                break  # Needed, or we go in the "else" clause.
        else:
            assert False, 'No "Created" entry found.'