Esempio n. 1
0
 def test_builds_valid_message_for_list(self):
     items = ['1', '2', '3', '4']
     message_builder = MessageBuilder()
     for item in items:
         message_builder.add(item)
     message = message_builder.build_message()
     expected = '1\n2\n3\n4'
     self.assertEquals(expected, message)
Esempio n. 2
0
 def test_builds_valid_message_for_post(self):
     search_term = 'some search'
     url = 'http://example.com/item1'
     feedUrl = 'http://example.com/feed'
     title = 'some title'
     content = 'some content'
     date_published = None
     author = 'some guy'
     entry = feedparser.FeedParserDict({'id': feedUrl})
     post = pshb.PostFactory.createPost(url, feedUrl, title, content,
                                        date_published, author, entry)
     message_builder = MessageBuilder()
     message = message_builder.build_message_from_post(post, search_term)
     expected = '[%s] matched post: [%s] with URL: [%s]' % (search_term,
                                                            title, url)
     self.assertEquals(expected, message)
Esempio n. 3
0
 def test_builds_valid_message_for_track_message(self):
     message_builder = MessageBuilder()
     message_builder.add('</track>')
     message = message_builder.build_message()
     expected = '%s' % '</track>'
     self.assertEquals(expected, message)
Esempio n. 4
0
 def test_builds_valid_message_for_simple_string(self):
     text = 'Tracking: some complex search'
     message_builder = MessageBuilder()
     message_builder.add(text)
     message = message_builder.build_message()
     self.assertEquals(text, message)