'Sets the user\'s language preference, allowing the LangPref middleware to operate to set the preference cookie.'

def set_lang_preference(self, language):

    response = self.client.patch(reverse('preferences_api', args=[self.user.username]), json.dumps({LANGUAGE_KEY: language}), content_type='application/merge-patch+json')
    self.assertEqual(response.status_code, 204)
