Skip to content

Commit

Permalink
Add changes file and fix schema.org protocol in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
protoroto committed Jul 27, 2023
1 parent b8c3daa commit 2babab6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions changes/152.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix schema.org protocol to be https
6 changes: 3 additions & 3 deletions tests/test_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ def test_as_meta_get_request_deprecation(self):
def test_templatetag(self):
self.post.as_meta()
response = self.client.get("/title/")
self.assertContains(response, '<html itemscope itemtype="http://schema.org/Article" >')
self.assertNotContains(response, ' itemscope itemtype="http://schema.org/Article"')
self.assertContains(response, '<html itemscope itemtype="https://schema.org/Article" >')
self.assertNotContains(response, ' itemscope itemtype="https://schema.org/Article"')
self.assertContains(response, 'article:published_time"')
self.assertContains(
response, '<meta name="twitter:image" content="http://example.com{}">'.format(self.image_url)
Expand Down Expand Up @@ -297,7 +297,7 @@ def test_google_plus_scope_works(self):
"""
Test vendorized googleplus_scope templatetag
"""
self.assertEqual(googleplus_html_scope("bar"), ' itemscope itemtype="http://schema.org/bar" ')
self.assertEqual(googleplus_html_scope("bar"), ' itemscope itemtype="https://schema.org/bar" ')

@override_settings(META_SITE_PROTOCOL="https")
def test_image_protocol(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ def test_google_plus_basically_works(self):
def test_google_plus_html_scope_works(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
self.assertEqual(googleplus_html_scope("bar"), ' itemscope itemtype="http://schema.org/bar" ')
self.assertEqual(googleplus_html_scope("bar"), ' itemscope itemtype="https://schema.org/bar" ')
assert len(w) == 1
assert issubclass(w[-1].category, PendingDeprecationWarning)

def test_google_plus_scope_works(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
self.assertEqual(googleplus_scope("bar"), ' itemscope itemtype="http://schema.org/bar" ')
self.assertEqual(googleplus_scope("bar"), ' itemscope itemtype="https://schema.org/bar" ')
assert len(w) == 1
assert issubclass(w[-1].category, PendingDeprecationWarning)

Expand Down Expand Up @@ -174,7 +174,7 @@ def test_meta_namespaces_gplus(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
self.assertEqual(
meta_namespaces_gplus(context_use_schemaorg), ' itemscope itemtype="http://schema.org/Article" '
meta_namespaces_gplus(context_use_schemaorg), ' itemscope itemtype="https://schema.org/Article" '
)
assert len(w) == 1
assert issubclass(w[-1].category, PendingDeprecationWarning)
Expand All @@ -185,10 +185,10 @@ def test_schemaorg_basically_works(self):
self.assertEqual(schemaorg_prop("foo", "bar"), '<meta itemprop="foo" content="bar">')

def test_schemaorg_html_scope_works(self):
self.assertEqual(schemaorg_html_scope("bar"), ' itemscope itemtype="http://schema.org/bar" ')
self.assertEqual(schemaorg_html_scope("bar"), ' itemscope itemtype="https://schema.org/bar" ')

def test_schemaorg_scope_works(self):
self.assertEqual(schemaorg_scope("bar"), ' itemscope itemtype="http://schema.org/bar" ')
self.assertEqual(schemaorg_scope("bar"), ' itemscope itemtype="https://schema.org/bar" ')

def test_schemaorg_escapes_xss(self):
self.assertEqual(schemaorg_prop('fo"o', "b<ar"), '<meta itemprop="fo&quot;o" content="b&lt;ar">')
Expand All @@ -202,7 +202,7 @@ def test_meta_namespaces_gplus(self):
self.assertEqual(meta_namespaces_schemaorg(context_no_use_schemaorg), "")

self.assertEqual(
meta_namespaces_schemaorg(context_use_schemaorg), ' itemscope itemtype="http://schema.org/Article" '
meta_namespaces_schemaorg(context_use_schemaorg), ' itemscope itemtype="https://schema.org/Article" '
)


Expand Down

0 comments on commit 2babab6

Please sign in to comment.