def test_response_has_auth_token_and_sid(self, request_post):
        """Ensure that if the response has an auth token and a sessionid that
        the token is returned correctly and the sid set on the class.
        """
        gae_req = AppEngineRequest(url="/foo", appid="test", source="test",
                                   email="*****@*****.**", password="******")

        request_post.return_value = Mock(text="Auth=my_token\nSID=my_sid")

        token = gae_req.get_auth_token()

        self.assertEqual(token, "my_token")
        self.assertEqual(gae_req.sid, "my_sid")

        data = {
            "Email": "*****@*****.**",
            "Passwd": "foobar",
            "service": "ah",
            "source": "test",
            "accountType": "HOSTED_OR_GOOGLE"
        }

        request_post.assert_called_once_with(
            "https://www.google.com/accounts/ClientLogin", data=data)