mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #1110 from tshepang/deprecated
replace Deprecated method; use unittest.mock when available
This commit is contained in:
commit
9ebe06156c
2 changed files with 13 additions and 10 deletions
|
|
@ -193,17 +193,17 @@ class TestPage(unittest.TestCase):
|
||||||
'<a href="|tag|tagname">link</a>')
|
'<a href="|tag|tagname">link</a>')
|
||||||
page = Page(**args)
|
page = Page(**args)
|
||||||
content = page.get_content('http://notmyidea.org')
|
content = page.get_content('http://notmyidea.org')
|
||||||
self.assertEquals(content, ('A simple test, with a '
|
self.assertEqual(content, ('A simple test, with a '
|
||||||
'<a href="tag/tagname.html">link</a>'))
|
'<a href="tag/tagname.html">link</a>'))
|
||||||
|
|
||||||
# Category
|
# Category
|
||||||
args['content'] = ('A simple test, with a '
|
args['content'] = ('A simple test, with a '
|
||||||
'<a href="|category|category">link</a>')
|
'<a href="|category|category">link</a>')
|
||||||
page = Page(**args)
|
page = Page(**args)
|
||||||
content = page.get_content('http://notmyidea.org')
|
content = page.get_content('http://notmyidea.org')
|
||||||
self.assertEquals(content,
|
self.assertEqual(content,
|
||||||
('A simple test, with a '
|
('A simple test, with a '
|
||||||
'<a href="category/category.html">link</a>'))
|
'<a href="category/category.html">link</a>'))
|
||||||
|
|
||||||
def test_intrasite_link(self):
|
def test_intrasite_link(self):
|
||||||
# type does not take unicode in PY2 and bytes in PY3, which in
|
# type does not take unicode in PY2 and bytes in PY3, which in
|
||||||
|
|
@ -222,7 +222,7 @@ class TestPage(unittest.TestCase):
|
||||||
'<a href="|filename|article.rst">link</a>'
|
'<a href="|filename|article.rst">link</a>'
|
||||||
)
|
)
|
||||||
content = Page(**args).get_content('http://notmyidea.org')
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
content,
|
content,
|
||||||
'A simple test, with a '
|
'A simple test, with a '
|
||||||
'<a href="http://notmyidea.org/article.html">link</a>'
|
'<a href="http://notmyidea.org/article.html">link</a>'
|
||||||
|
|
@ -234,7 +234,7 @@ class TestPage(unittest.TestCase):
|
||||||
'<a href="|filename|article.rst#section-2">link</a>'
|
'<a href="|filename|article.rst#section-2">link</a>'
|
||||||
)
|
)
|
||||||
content = Page(**args).get_content('http://notmyidea.org')
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
content,
|
content,
|
||||||
'A simple test, with a '
|
'A simple test, with a '
|
||||||
'<a href="http://notmyidea.org/article.html#section-2">link</a>'
|
'<a href="http://notmyidea.org/article.html#section-2">link</a>'
|
||||||
|
|
@ -247,7 +247,7 @@ class TestPage(unittest.TestCase):
|
||||||
'?utm_whatever=234&highlight=word">link</a>'
|
'?utm_whatever=234&highlight=word">link</a>'
|
||||||
)
|
)
|
||||||
content = Page(**args).get_content('http://notmyidea.org')
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
content,
|
content,
|
||||||
'A simple test, with a '
|
'A simple test, with a '
|
||||||
'<a href="http://notmyidea.org/article.html'
|
'<a href="http://notmyidea.org/article.html'
|
||||||
|
|
@ -261,7 +261,7 @@ class TestPage(unittest.TestCase):
|
||||||
'?utm_whatever=234&highlight=word#section-2">link</a>'
|
'?utm_whatever=234&highlight=word#section-2">link</a>'
|
||||||
)
|
)
|
||||||
content = Page(**args).get_content('http://notmyidea.org')
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
content,
|
content,
|
||||||
'A simple test, with a '
|
'A simple test, with a '
|
||||||
'<a href="http://notmyidea.org/article.html'
|
'<a href="http://notmyidea.org/article.html'
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from codecs import open
|
from codecs import open
|
||||||
from mock import MagicMock
|
try:
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
except ImportError:
|
||||||
|
from mock import MagicMock
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue