You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2021/01/06 21:50:19 UTC
[allura] branch master updated: Youtube oembed test: be ok with
different but similar outcomes
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 3bedd33 Youtube oembed test: be ok with different but similar outcomes
3bedd33 is described below
commit 3bedd33cd580dbf7d6e93e752b3fb88c01549aa7
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Jan 6 16:49:25 2021 -0500
Youtube oembed test: be ok with different but similar outcomes
---
Allura/allura/tests/test_globals.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index ddc0d94..954a15b 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -25,6 +25,7 @@ import os
import allura
import unittest
import hashlib
+import six
from mock import patch, Mock
from bson import ObjectId
@@ -351,8 +352,12 @@ def test_macro_embed(oembed_fetch):
def test_macro_embed_video_gone():
# this does a real fetch
r = g.markdown_wiki.convert('[[embed url=https://www.youtube.com/watch?v=OWsFqPZ3v-0]]')
- assert_equal(r, '<div class="markdown_content"><p>Could not embed: '
- 'https://www.youtube.com/watch?v=OWsFqPZ3v-0</p></div>')
+ r = six.text_type(r) # convert away from Markup, to get better assertion diff output
+ # either of these could happen depending on the mood of youtube's oembed API:
+ assert_in(r, [
+ '<div class="markdown_content"><p>Video not available</p></div>',
+ '<div class="markdown_content"><p>Could not embed: https://www.youtube.com/watch?v=OWsFqPZ3v-0</p></div>',
+ ])
@patch('oembed.OEmbedEndpoint.fetch')