def test_defaults(self):
        """Parameters should be set correctly inside the class using defaults."""
        person = Person(client=self.client)

        self.assertEqual(person._client, self.client)  # pylint: disable=protected-access
        self.assertEqual(person._api_version, "v1")  # pylint: disable=protected-access
        self.assertEqual(person._api_url, self.api_url)  # pylint: disable=protected-access
    def test_email(self):
        """The function should return the Person ID corresponding to the email passed."""
        # Setup the mocked response
        test_email = "*****@*****.**"
        quoted_email = quote(test_email.replace(".", "%2E"))
        test_url = f"{self.api_url}/id/byEmail/{quoted_email}"
        test_result = {"personId": 51}

        responses.add(responses.GET, test_url, json=test_result, status=200)

        person = Person(client=self.client)
        data = person.find(email=test_email)

        # Verify all the query information
        self.assertEqual(len(responses.calls), 1)
        self.assertEqual(responses.calls[0].request.url, test_url)
        self.assertEqual(data, test_result)
    def test_not_found(self):
        """The function should raise an HTTPError exception if a person by that email is not found."""
        # Setup the mocked response
        test_email = "*****@*****.**"
        quoted_email = quote(test_email.replace(".", "%2E"))
        test_url = f"{self.api_url}/id/byEmail/{quoted_email}"
        test_result = {
            "code":
            -105,
            "description":
            f"Person with e-mail: {unquote(quoted_email)} was not found"
        }

        responses.add(responses.GET, test_url, json=test_result, status=404)

        person = Person(client=self.client)
        self.assertRaises(HTTPError, person.find, email=test_email)

        # Verify all the query information
        self.assertEqual(len(responses.calls), 1)
        self.assertEqual(responses.calls[0].request.url, test_url)