Example #1
0
 def test_weird_query_strings(self):
     """Ensure strange characters are handled"""
     links = parse_links(
         'http://pjuu.com:5000/a/post/url?page=1&q=abc,def#something')
     self.assertEqual(
         links[0]['link'],
         'http://pjuu.com:5000/a/post/url?page=1&q=abc,def#something')
Example #2
0
 def test_weird_query_strings(self):
     """Ensure strange characters are handled"""
     links = parse_links(
         'http://pjuu.com:5000/a/post/url?page=1&q=abc,def#something')
     self.assertEqual(
         links[0]['link'],
         'http://pjuu.com:5000/a/post/url?page=1&q=abc,def#something')
Example #3
0
 def test_quoting_mentions_hashtags(self):
     """Parenthesis around items"""
     links = parse_links('"https://pjuu.com/user1"')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/user1')
     hashtags = parse_hashtags('"#pjuu"')
     self.assertEqual(hashtags[0]['hashtag'], 'pjuu')
     mentions = parse_mentions('"@joe"', check_user=False)
     self.assertEqual(mentions[0]['username'], 'joe')
Example #4
0
 def test_quoting_mentions_hashtags(self):
     """Parenthesis around items"""
     links = parse_links('"https://pjuu.com/user1"')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/user1')
     hashtags = parse_hashtags('"#pjuu"')
     self.assertEqual(hashtags[0]['hashtag'], 'pjuu')
     mentions = parse_mentions('"@joe"', check_user=False)
     self.assertEqual(mentions[0]['username'], 'joe')
Example #5
0
 def test_anchors_in_urls(self):
     """Query strings and anchor points"""
     links = parse_links('https://pjuu.com/joe?page=2#hello')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/joe?page=2#hello')
Example #6
0
 def test_urls_are_fixed(self):
     """Ensure simple link are fixed up."""
     links = parse_links('Hello pjuu.com')
     self.assertEqual(links[0]['link'], 'http://pjuu.com')
     self.assertEqual(links[0]['span'], (6, 14))
Example #7
0
 def test_simple_url_https(self):
     """Simpe HTTPS urls"""
     links = parse_links('Hello https://pjuu.com')
     self.assertEqual(links[0]['link'], 'https://pjuu.com')
Example #8
0
 def test_parenethesis_in_paths(self):
     """Handle URLs surrounded by parenthesis and containing them."""
     links = parse_links('(https://pjuu.com/user1)')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/user1')
     links = parse_links('https://pjuu.com/user1(awesome)')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/user1(awesome)')
Example #9
0
 def test_anchors_in_urls(self):
     """Query strings and anchor points"""
     links = parse_links('https://pjuu.com/joe?page=2#hello')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/joe?page=2#hello')
Example #10
0
 def test_urls_are_fixed(self):
     """Ensure simple link are fixed up."""
     links = parse_links('Hello pjuu.com')
     self.assertEqual(links[0]['link'], 'http://pjuu.com')
     self.assertEqual(links[0]['span'], (6, 14))
Example #11
0
 def test_simple_url_https(self):
     """Simpe HTTPS urls"""
     links = parse_links('Hello https://pjuu.com')
     self.assertEqual(links[0]['link'], 'https://pjuu.com')
Example #12
0
 def test_parenethesis_in_paths(self):
     """Handle URLs surrounded by parenthesis and containing them."""
     links = parse_links('(https://pjuu.com/user1)')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/user1')
     links = parse_links('https://pjuu.com/user1(awesome)')
     self.assertEqual(links[0]['link'], 'https://pjuu.com/user1(awesome)')