'Tests certificate template asset display by slug using static.certificate_asset_url method.'

@override_settings(FEATURES=FEATURES_WITH_CUSTOM_CERTS_ENABLED)
def test_certificate_asset_by_slug(self):

    self._add_course_certificates(count=1, signatory_count=2)
    self._create_custom_template(mode='honor')
    test_url = get_certificate_url(user_id=self.user.id, course_id=unicode(self.course.id))
    with patch('certificates.api.get_course_organizations') as mock_get_orgs:
        mock_get_orgs.return_value = []
        response = self.client.get(test_url)
        self.assertContains(response, '<img    class="custom-logo"    src=""    />')
    template_asset = CertificateTemplateAsset(description='custom    logo', asset='certificate_template_assets/32/test_logo.png', asset_slug='custom-logo')
    template_asset.save()
    with patch('certificates.api.get_course_organizations') as mock_get_orgs:
        mock_get_orgs.return_value = []
        response = self.client.get(test_url)
        self.assertContains(response, '<img    class="custom-logo"    src="{}certificate_template_assets/32/test_logo.png"    />'.format(settings.MEDIA_URL))
