@@ -150,6 +150,19 @@ def test_sharing_bar_with_staff_user(self):
150150
151151 self .assertContains (response , "Print or share your certificate" )
152152
153+ @responses .activate
154+ def test_open_graph_metadata (self ):
155+ """Verify that the anonymous view contains OpenGraph metadata."""
156+ self .client .logout ()
157+ response = self ._render_user_credential ()
158+
159+ self .assertContains (response , "og:url" )
160+ self .assertContains (response , "og:title" )
161+ self .assertContains (response , "og:description" )
162+ self .assertContains (response , '"og:type" content="image/png"' )
163+ self .assertContains (response , self .user_credential .get_absolute_url ())
164+ self .assertContains (response , "I completed a course at " )
165+
153166 @responses .activate
154167 def test_awarded_with_logged_in_user (self ):
155168 """Verify that the view renders awarded certificates with sharing bar."""
@@ -160,7 +173,7 @@ def test_awarded_with_logged_in_user(self):
160173 self .assertContains (response , "Print or share your certificate" )
161174 self .assertContains (response , "Print this certificate" )
162175
163- self .assertContains (response = response , text = self .PROGRAM_NAME , count = 2 )
176+ self .assertContains (response = response , text = self .PROGRAM_NAME , count = 3 )
164177 self .assertNotContains (response = response , text = self .CREDENTIAL_TITLE )
165178
166179 self .assertEqual (response_context_data ["user_credential" ], self .user_credential )
@@ -226,7 +239,7 @@ def test_awarded_with_custom_title(self):
226239
227240 self .assertContains (response , "Print or share your certificate" )
228241 self .assertNotContains (response = response , text = self .PROGRAM_NAME )
229- self .assertContains (response = response , text = self .CREDENTIAL_TITLE , count = 2 )
242+ self .assertContains (response = response , text = self .CREDENTIAL_TITLE , count = 3 )
230243
231244 def test_revoked (self ):
232245 """Verify that the view returns 404 when the uuid is valid but certificate status
0 commit comments