'Tests custom template search if we have a single template for organization and mode
with course set to Null.
This test should check template matching when org={org}, course=Null, mode={mode}.'

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

    course = CourseFactory.create(org='cstX', number='cst_22', display_name='custom    template    course')
    self._add_course_certificates(count=1, signatory_count=2)
    self._create_custom_template(org_id=1, mode='honor')
    self._create_custom_template(org_id=1, mode='honor', course_key=course.id)
    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.side_effect = [[{'id': 1, 'name': 'organization    name'}]]
        response = self.client.get(test_url)
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'course    name:    course_title_0')
