Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch property to cached_property #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Switch property to cached_property

d0c689b
Select commit
Loading
Failed to load commit list.
Open

Switch property to cached_property #73

Switch property to cached_property
d0c689b
Select commit
Loading
Failed to load commit list.
Azure Pipelines / wagtail-seo failed Sep 27, 2024 in 1m 47s

Build #20240927.5 had test failures

Details

Tests

  • Failed: 2 (5.00%)
  • Passed: 38 (95.00%)
  • Other: 0 (0.00%)
  • Total: 40
Code coverage

  • 345 of 361 line covered (95.57%)

Annotations

Check failure on line 183 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / wagtail-seo

Build log #L183

Bash exited with code '1'.

Check failure on line 190 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / wagtail-seo

Build log #L190

Bash exited with code '1'.

Check failure on line 1 in test_struct_org

See this annotation in the file changed.

@azure-pipelines azure-pipelines / wagtail-seo

test_struct_org

AssertionError: False is not true : Couldn't find '<script type="application/ld+json">
{"@context": "http://schema.org", "@type": "Airline", "url": "http://localhost/fullseo/", "name": "Custom Org Name", "logo": {"@type": "ImageObject", "url": "http://localhost/media/images/test_pGZ0Znf.original_BcKrMFG.png"}, "image": ["http://localhost/media/images/test_mTcXSB0.2e16d0ba.fill-10000x10000_BPhbvZk.png", "http://localhost/media/images/test_mTcXSB0.2e16d0ba.fill-40000x30000_elKg4BN.png", "http://localhost/media/images/test_mTcXSB0.2e16d0ba.fill-16000x9000_fYU8l2N.png"], "telephone": "+1-555-867-5309", "address": {"@type": "PostalAddress", "streetAddress": "55 Public Square, Suite 1710", "addressLocality": "Cleveland", "addressRegion": "OH", "postalCode": "44113", "addressCountry": "US"}, "geo": {"@type": "GeoCoordinates", "latitude": 1.1, "longitude": 2.2}, "openingHoursSpecification": [{"@type": "OpeningHoursSpecification", "dayOfWeek": ["Monday", "Tuesday", "Wednesday"], "opens": "09:00:00", "closes": "17:00:00"}], "potentialAction": [{"@type": "OrderAction", "target": {"@type": "EntryPoint", "urlTemplate": "https://www.example.com/", "inLanguage": "en-US", "actionPlatform": ["http://schema.org/DesktopWebPlatform", "http://schema.org/IOSPlatform", "http://schema.org/AndroidPlatform"]}, "result": {"@type": "FoodEstablishmentReservation", "name": "Custom Result"}}], "json": true, "array": ["thing1", "thing2"]}
</script>' in response
Raw output
self = <home.tests.SeoTest testMethod=test_struct_org>

    def test_struct_org(self):
        """
        A page with SeoMixin should render correct structured data.
        """
        page = self.page_fullseo
    
        # Manually render the JSON and match against page HTML.
        # Get images to compare against rendered content.
        base_url = utils.get_absolute_media_url(page.get_site())
        img1x1 = (
            base_url
            + self.seo_set.struct_org_image.get_rendition(
                "fill-10000x10000"
            ).url
        )
        img4x3 = (
            base_url
            + self.seo_set.struct_org_image.get_rendition(
                "fill-40000x30000"
            ).url
        )
        img16x9 = (
            base_url
            + self.seo_set.struct_org_image.get_rendition("fill-16000x9000").url
        )
        expected_dict = {
            "@context": "http://schema.org",
            "@type": self.seo_set.struct_org_type,
            "url": page.seo_canonical_url,
            "name": page.seo_struct_org_name,
            "logo": {
                "@type": "ImageObject",
                "url": page.seo_logo_url,
            },
            "image": [img1x1, img4x3, img16x9],
            "telephone": self.seo_set.struct_org_phone,
            "address": {
                "@type": "PostalAddress",
                "streetAddress": self.seo_set.struct_org_address_street,
                "addressLocality": self.seo_set.struct_org_address_locality,
                "addressRegion": self.seo_set.struct_org_address_region,
                "postalCode": self.seo_set.struct_org_address_postal,
                "addressCountry": self.seo_set.struct_org_address_country,
            },
            "geo": {
                "@type": "GeoCoordinates",
                "latitude": float(self.seo_set.struct_org_geo_lat),
                "longitude": float(self.seo_set.struct_org_geo_lng),
            },
            "openingHoursSpecification": [],
            "potentialAction": [],
        }
        for spec in self.seo_set.struct_org_hours:
            expected_dict["openingHoursSpecification"].append(
                spec.value.struct_dict
            )
        for action in self.seo_set.struct_org_actions:
            expected_dict["potentialAction"].append(action.value.struct_dict)
        expected_dict.update(json.loads(self.seo_set.struct_org_extra_json))
    
        expected_json = json.dumps(expected_dict, cls=utils.StructDataEncoder)
    
        # GET the page and check its JSON against expected JSON.
        response = self.client.get(page.get_url())
        self.assertEqual(response.status_code, 200)
        self.maxDiff = None
        print(response.content.decode("utf8"))
>       self.assertInHTML(
            f"""
            <script type="application/ld+json">
            { expected_json }
            </script>
            """,  # noqa
            response.content.decode("utf8"),
        )

testproject/home/tests.py:279: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/django/test/testcases.py:993: in assertInHTML
    self.assertTrue(
E   AssertionError: False is not true : Couldn't find '<script type="application/ld+json">
E   {"@context": "http://schema.org", "@type": "Airline", "url": "http://localhost/fullseo/", "name": "Custom Org Name", "logo": {"@type": "ImageObject", "url": "http://localhost/media/images/test_pGZ0Znf.original_BcKrMFG.png"}, "image": ["http://localhost/media/images/test_mTcXSB0.2e16d0ba.fill-10000x10000_BPhbvZk.png", "http://localhost/media/images/test_mTcXSB0.2e16d0ba.fill-40000x30000_elKg4BN.png", "http://localhost/media/images/test_mTcXSB0.2e16d0ba.fill-16000x9000_fYU8l2N.png"], "telephone": "+1-555-867-5309", "address": {"@type": "PostalAddress", "streetAddress": "55 Public Square, Suite 1710", "addressLocality": "Cleveland", "addressRegion": "OH", "postalCode":

Check failure on line 1 in test_struct_org

See this annotation in the file changed.

@azure-pipelines azure-pipelines / wagtail-seo

test_struct_org

AssertionError: False is not true : Couldn't find '<script type="application/ld+json">
{&quot;@context&quot;: &quot;http://schema.org&quot;, &quot;@type&quot;: &quot;Airline&quot;, &quot;url&quot;: &quot;http://localhost/fullseo/&quot;, &quot;name&quot;: &quot;Custom Org Name&quot;, &quot;logo&quot;: {&quot;@type&quot;: &quot;ImageObject&quot;, &quot;url&quot;: &quot;http://localhost/media/images/test_qSYu45N.original_Of9bzIu.png&quot;}, &quot;image&quot;: [&quot;http://localhost/media/images/test_7VBhMJr.2e16d0ba.fill-10000x10000_N7C3WT1.png&quot;, &quot;http://localhost/media/images/test_7VBhMJr.2e16d0ba.fill-40000x30000_4xIaw0M.png&quot;, &quot;http://localhost/media/images/test_7VBhMJr.2e16d0ba.fill-16000x9000_nqDGUMB.png&quot;], &quot;telephone&quot;: &quot;+1-555-867-5309&quot;, &quot;address&quot;: {&quot;@type&quot;: &quot;PostalAddress&quot;, &quot;streetAddress&quot;: &quot;55 Public Square, Suite 1710&quot;, &quot;addressLocality&quot;: &quot;Cleveland&quot;, &quot;addressRegion&quot;: &quot;OH&quot;, &quot;postalCode&quot;: &quot;44113&quot;, &quot;addressCountry&quot;: &quot;US&quot;}, &quot;geo&quot;: {&quot;@type&quot;: &quot;GeoCoordinates&quot;, &quot;latitude&quot;: 1.1, &quot;longitude&quot;: 2.2}, &quot;openingHoursSpecification&quot;: [{&quot;@type&quot;: &quot;OpeningHoursSpecification&quot;, &quot;dayOfWeek&quot;: [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;], &quot;opens&quot;: &quot;09:00:00&quot;, &quot;closes&quot;: &quot;17:00:00&quot;}], &quot;potentialAction&quot;: [{&quot;@type&quot;: &quot;OrderAction&quot;, &quot;target&quot;: {&quot;@type&quot;: &quot;EntryPoint&quot;, &quot;urlTemplate&quot;: &quot;https://www.example.com/&quot;, &quot;inLanguage&quot;: &quot;en-US&quot;, &quot;actionPlatform&quot;: [&quot;http://schema.org/DesktopWebPlatform&quot;, &quot;http://schema.org/IOSPlatform&quot;, &quot;http://schema.org/AndroidPlatform&quot;]}, &quot;result&quot;: {&quot;@type&quot;: &quot;FoodEstablishmentReservation&quot;, &quot;name&quot;: &quot;Custom Result&quot;}}], &quot;json&quot;: true, &quot;array&quot;: [&quot;thing1&quot;, &quot;thing2&quot;]}
</script>' in response
Raw output
self = <home.tests.SeoTest testMethod=test_struct_org>

    def test_struct_org(self):
        """
        A page with SeoMixin should render correct structured data.
        """
        page = self.page_fullseo
    
        # Manually render the JSON and match against page HTML.
        # Get images to compare against rendered content.
        base_url = utils.get_absolute_media_url(page.get_site())
        img1x1 = (
            base_url
            + self.seo_set.struct_org_image.get_rendition(
                "fill-10000x10000"
            ).url
        )
        img4x3 = (
            base_url
            + self.seo_set.struct_org_image.get_rendition(
                "fill-40000x30000"
            ).url
        )
        img16x9 = (
            base_url
            + self.seo_set.struct_org_image.get_rendition("fill-16000x9000").url
        )
        expected_dict = {
            "@context": "http://schema.org",
            "@type": self.seo_set.struct_org_type,
            "url": page.seo_canonical_url,
            "name": page.seo_struct_org_name,
            "logo": {
                "@type": "ImageObject",
                "url": page.seo_logo_url,
            },
            "image": [img1x1, img4x3, img16x9],
            "telephone": self.seo_set.struct_org_phone,
            "address": {
                "@type": "PostalAddress",
                "streetAddress": self.seo_set.struct_org_address_street,
                "addressLocality": self.seo_set.struct_org_address_locality,
                "addressRegion": self.seo_set.struct_org_address_region,
                "postalCode": self.seo_set.struct_org_address_postal,
                "addressCountry": self.seo_set.struct_org_address_country,
            },
            "geo": {
                "@type": "GeoCoordinates",
                "latitude": float(self.seo_set.struct_org_geo_lat),
                "longitude": float(self.seo_set.struct_org_geo_lng),
            },
            "openingHoursSpecification": [],
            "potentialAction": [],
        }
        for spec in self.seo_set.struct_org_hours:
            expected_dict["openingHoursSpecification"].append(
                spec.value.struct_dict
            )
        for action in self.seo_set.struct_org_actions:
            expected_dict["potentialAction"].append(action.value.struct_dict)
        expected_dict.update(json.loads(self.seo_set.struct_org_extra_json))
    
        expected_json = json.dumps(expected_dict, cls=utils.StructDataEncoder)
    
        # GET the page and check its JSON against expected JSON.
        response = self.client.get(page.get_url())
        self.assertEqual(response.status_code, 200)
        self.maxDiff = None
        print(response.content.decode("utf8"))
>       self.assertInHTML(
            f"""
            <script type="application/ld+json">
            { expected_json }
            </script>
            """,  # noqa
            response.content.decode("utf8"),
        )

testproject/home/tests.py:279: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/test/testcases.py:1064: in assertInHTML
    self.assertTrue(
E   AssertionError: False is not true : Couldn't find '<script type="application/ld+json">
E   {&quot;@context&quot;: &quot;http://schema.org&quot;, &quot;@type&quot;: &quot;Airline&quot;, &quot;url&quot;: &quot;http://localhost/fullseo/&quot;, &quot;name&quot;: &quot;Custom Org Name&quot;, &quot;logo&quot;: {&quot;@type&quot;: &quot;ImageObject&quot;, &quot;url&quot;: &quot;http://localhost/media/images/test_qSYu45N.original_Of9bzIu.png&quot;}, &quot;image&quot;: [&quot;http://localhost/media/images/test_7VBhMJr.2e16d0ba.fill-10000x10000_N7C3WT1.png&quot;, &quot;http://localhost/media/images/test_7VBhMJr.2e16d0ba.fill-40000x30000_4xIaw0M.png&quot;, &quot;http://localhost/media/images/test_7VBhMJr.2e16d0ba.fill-16000x9000_nqDGUMB.png&quot;], &quot;telephone&