Exemple #1
0
 def test_no_autolinks(self):
     orig_message = 'This is a message with no autolinks'
     body = emailmarkdown(orig_message)
     comparison_message = '<!-- SC_OFF --><div class="md"><p>'\
                          'This is a message with no autolinks</p>\n'\
                          '</div><!-- SC_ON -->'
     self.assertEquals(comparison_message, body)
Exemple #2
0
 def test_regular_link(self):
     orig_message = 'You should visit https://reddit.com/r/test'
     body = emailmarkdown(orig_message)
     comparison_message = '<!-- SC_OFF --><div class="md"><p>You should '\
                          'visit <a href="https://reddit.com/r/test">'\
                          'https://reddit.com/r/test</a></p>\n</div>'\
                          '<!-- SC_ON -->'
     self.assertEquals(comparison_message, body)
Exemple #3
0
 def test_no_leading_slash__username(self):
     # test user with no leading slash
     orig_message = 'Visit u/test'
     body = emailmarkdown(orig_message)
     comparison_message = '<!-- SC_OFF --><div class="md"><p>Visit '\
                          '<a href="https://reddit.com/u/test">u/test</a>'\
                          '</p>\n</div><!-- SC_ON -->'
     self.assertEquals(comparison_message, body)
Exemple #4
0
 def test_punctuation(self):
     # test subreddit with punctuation
     orig_message = 'Visit r/test.'
     body = emailmarkdown(orig_message)
     comparison_message = '<!-- SC_OFF --><div class="md"><p>Visit '\
                          '<a href="https://reddit.com/r/test">r/test</a>'\
                          '.</p>\n</div><!-- SC_ON -->'
     self.assertEquals(comparison_message, body)
Exemple #5
0
 def test_leading_slash__sr(self):
     # test subreddit with leading slash (/r/)
     orig_message = 'Visit /r/test'
     body = emailmarkdown(orig_message)
     comparison_message = '<!-- SC_OFF --><div class="md"><p>Visit '\
                          '<a href="https://reddit.com/r/test">/r/test</a>'\
                          '</p>\n</div><!-- SC_ON -->'
     self.assertEquals(comparison_message, body)
Exemple #6
0
 def test_two_autolinks(self):
     # test two links
     orig_message = 'hey u/sam you should visit r/test'
     body = emailmarkdown(orig_message)
     comparison_message = '<!-- SC_OFF --><div class="md"><p>hey '\
                          '<a href="https://reddit.com/u/sam">u/sam</a>'\
                          ' you should visit <a href='\
                          '"https://reddit.com/r/test">r/test</a></p>\n'\
                          '</div><!-- SC_ON -->'
     self.assertEquals(comparison_message, body)