예제 #1
0
    def test_bind_endpoint_to_base_url_endpoint_not_string(self) -> None:
        """
        Tests of the method which let us bind an endpoint with the previouly
        given base url for the case that the given endpoint is a non-string.
        """

        given_base_url = "https://example.org/api"
        given_endpoint = True

        requester = Requester()
        requester.set_base_url(given_base_url)

        self.assertRaises(
            TypeError,
            lambda: requester.bind_endpoint_to_base_url(given_endpoint))
예제 #2
0
    def test_bind_endpoint_to_base_url(self) -> None:
        """
        Tests of the method which let us bind an endpoint with the previously
        given base url.
        """

        given_base_url = "https://example.org/api"
        given_endpoint = "hello/world"
        expected = "https://example.org/api/hello/world"

        requester = Requester()
        requester.set_base_url(given_base_url)

        actual = requester.bind_endpoint_to_base_url(given_endpoint)

        self.assertEqual(expected, actual)