'Assert that we cannot submit a CourseEmailTemplateForm with a name
that already exists'

def test_duplicate_name(self):

    form_data = {'html_template': '{{message_body}}', 'plain_template': '{{message_body}}', 'name': 'foo'}
    form = CourseEmailTemplateForm(form_data)
    self.assertTrue(form.is_valid())
    form.save()
    form = CourseEmailTemplateForm(form_data)
    self.assertFalse(form.is_valid())
    form_data = {'html_template': '{{message_body}}', 'plain_template': '{{message_body}}', 'name': '        foo    '}
    form = CourseEmailTemplateForm(form_data)
    self.assertFalse(form.is_valid())
    form_data = {'html_template': '{{message_body}}', 'plain_template': '{{message_body}}', 'name': 'bar'}
    form = CourseEmailTemplateForm(form_data)
    self.assertTrue(form.is_valid())
    form.save()
    form = CourseEmailTemplateForm(form_data)
    self.assertFalse(form.is_valid())
