'Tests the email opt in preference'

@ddt.data((u'True', u'True'), (u'true', u'True'), (u'TrUe', u'True'), (u'Banana', u'False'), (u'strawberries', u'False'), (u'False', u'False'))
@ddt.unpack
def test_update_email_opt_in(self, opt, result):

    response = self.client.post(self.url, {'course_id': unicode(self.course.id), 'email_opt_in': opt})
    self.assertHttpOK(response)
    preference = UserOrgTag.objects.get(user=self.user, org=self.course.id.org, key='email-optin')
    self.assertEquals(preference.value, result)
