Пример #1
0
    def __init__(self, focused_update, **kwargs):
        og_data = {
            "type": "article",
            "url": make_event_url(c.liveupdate_event._id),
            "description": trunc_string(
                focused_update.body.strip(), MAX_DESCRIPTION_LENGTH),
            "image": static("liveupdate-logo.png"),
            "image:width": "300",
            "image:height": "300",
            "site_name": "reddit",
        }

        LiveUpdateEventPage.__init__(
            self,
            og_data=og_data,
            **kwargs
        )
Пример #2
0
    def __init__(self, focused_update, **kwargs):
        og_data = {
            "type": "article",
            "url": make_event_url(c.liveupdate_event._id),
            "description": trunc_string(
                focused_update.body.strip(), MAX_DESCRIPTION_LENGTH),
            "image": static("liveupdate-logo.png"),
            "image:width": "300",
            "image:height": "300",
            "site_name": "reddit",
        }

        LiveUpdateEventPage.__init__(
            self,
            og_data=og_data,
            **kwargs
        )
Пример #3
0
 def test_really_long_words(self):
     truncated = utils.trunc_string('ThisIsALongWord', 10)
     self.assertEqual(truncated, 'ThisIsA...')
Пример #4
0
 def test_word_breaks(self):
     truncated = utils.trunc_string('two words', 6)
     self.assertEqual(truncated, 'two...')
Пример #5
0
 def test_suffix(self):
     truncated = utils.trunc_string('two words', 6, '')
     self.assertEqual(truncated, 'two')
Пример #6
0
 def test_empty_string(self):
     truncated = utils.trunc_string('', 80)
     self.assertEqual(truncated, '')
Пример #7
0
 def test_short_enough(self):
     truncated = utils.trunc_string('short string', 80)
     self.assertEqual(truncated, 'short string')
Пример #8
0
 def test_really_long_words(self):
     truncated = utils.trunc_string('ThisIsALongWord', 10)
     self.assertEqual(truncated, 'ThisIsA...')
Пример #9
0
 def test_suffix(self):
     truncated = utils.trunc_string('two words', 6, '')
     self.assertEqual(truncated, 'two')
Пример #10
0
 def test_word_breaks(self):
     truncated = utils.trunc_string('two words', 6)
     self.assertEqual(truncated, 'two...')
Пример #11
0
 def test_short_enough(self):
     truncated = utils.trunc_string('short string', 80)
     self.assertEqual(truncated, 'short string')
Пример #12
0
 def test_empty_string(self):
     truncated = utils.trunc_string('', 80)
     self.assertEqual(truncated, '')