'Test that with invalid key it returns bad request
and not update their email optin preference.'

def test_update_email_opt_with_invalid_course_key(self):

    response = self.client.post(self.url, {'course_id': 'invalid', 'email_opt_in': u'True'})
    self.assertHttpBadRequest(response)
    with self.assertRaises(UserOrgTag.DoesNotExist):
        UserOrgTag.objects.get(user=self.user, org=self.course.id.org, key='email-optin')
