Example #1
0
 def test_oembed_return_values(self, loads, urlopen):
     urlopen.return_value = self.dummy_response
     loads.return_value = {
         "type": "something",
         "url": "http://www.example.com",
         "title": "test_title",
         "author_name": "test_author",
         "provider_name": "test_provider_name",
         "thumbnail_url": "test_thumbail_url",
         "width": "test_width",
         "height": "test_height",
         "html": "test_html",
     }
     result = wagtail_oembed("http://www.youtube.com/watch/")
     self.assertEqual(
         result,
         {
             "type": "something",
             "title": "test_title",
             "author_name": "test_author",
             "provider_name": "test_provider_name",
             "thumbnail_url": "test_thumbail_url",
             "width": "test_width",
             "height": "test_height",
             "html": "test_html",
         },
     )
Example #2
0
 def test_oembed_return_values(self, loads, urlopen):
     urlopen.return_value = self.dummy_response
     loads.return_value = {
         'type': 'something',
         'url': 'http://www.example.com',
         'title': 'test_title',
         'author_name': 'test_author',
         'provider_name': 'test_provider_name',
         'thumbnail_url': 'test_thumbail_url',
         'width': 'test_width',
         'height': 'test_height',
         'html': 'test_html'
     }
     result = wagtail_oembed("http://www.youtube.com/watch/")
     self.assertEqual(
         result, {
             'type': 'something',
             'title': 'test_title',
             'author_name': 'test_author',
             'provider_name': 'test_provider_name',
             'thumbnail_url': 'test_thumbail_url',
             'width': 'test_width',
             'height': 'test_height',
             'html': 'test_html'
         })
Example #3
0
 def test_oembed_photo_request(self, loads, urlopen):
     urlopen.return_value = self.dummy_response
     loads.return_value = {"type": "photo", "url": "http://www.example.com"}
     result = wagtail_oembed("http://www.youtube.com/watch/")
     self.assertEqual(result["type"], "photo")
     self.assertEqual(result["html"], '<img src="http://www.example.com" />')
     loads.assert_called_with("foo")
Example #4
0
 def test_oembed_photo_request(self, loads, urlopen):
     urlopen.return_value = self.dummy_response
     loads.return_value = {'type': 'photo',
                           'url': 'http://www.example.com'}
     result = wagtail_oembed("http://www.youtube.com/watch/")
     self.assertEqual(result['type'], 'photo')
     self.assertEqual(result['html'], '<img src="http://www.example.com" />')
     loads.assert_called_with("foo")
Example #5
0
 def test_oembed_return_values(self, loads, urlopen):
     urlopen.return_value = self.dummy_response
     loads.return_value = {
         'type': 'something',
         'url': 'http://www.example.com',
         'title': 'test_title',
         'author_name': 'test_author',
         'provider_name': 'test_provider_name',
         'thumbnail_url': 'test_thumbail_url',
         'width': 'test_width',
         'height': 'test_height',
         'html': 'test_html'
     }
     result = wagtail_oembed("http://www.youtube.com/watch/")
     self.assertEqual(result, {
         'type': 'something',
         'title': 'test_title',
         'author_name': 'test_author',
         'provider_name': 'test_provider_name',
         'thumbnail_url': 'test_thumbail_url',
         'width': 'test_width',
         'height': 'test_height',
         'html': 'test_html'
     })