def test_patch_email(self):
        """
        Test that the user can request an email change through the accounts API.
        Full testing of the helper method used (do_email_change_request) exists in the package with the code.
        Here just do minimal smoke testing.
        """
        client = self.login_client("client", "user")
        old_email = self.user.email
        new_email = "newemail@example.com"
        response = self.send_patch(client, {"email": new_email, "goals": "change my email"})

        # Since request is multi-step, the email won't change on GET immediately (though goals will update).
        assert old_email == response.data['email']
        assert 'change my email' == response.data['goals']

        # Now call the method that will be invoked with the user clicks the activation key in the received email.
        # First we must get the activation key that was sent.
        pending_change = PendingEmailChange.objects.filter(user=self.user)
        assert 1 == len(pending_change)
        activation_key = pending_change[0].activation_key
        confirm_change_url = reverse(
            "confirm_email_change", kwargs={'key': activation_key}
        )
        response = self.client.post(confirm_change_url)
        assert 200 == response.status_code
        get_response = self.send_get(client)
        assert new_email == get_response.data['email']