def test_endpoint_from_url(self): test = Record( { "id": 123, "name": "test", "url": "http://localhost:8080/api/test-app/test-endpoint/1/", }, Mock(), None, ) ret = test._endpoint_from_url(test.url) self.assertEqual(ret.name, "test-endpoint")
def test_endpoint_from_url_with_directory_in_base_url(self): api = Mock() api.base_url = "http://localhost:8080/testing/api" test = Record( { "id": 123, "name": "test", "url": "http://localhost:8080/testing/api/test-app/test-endpoint/1/", }, api, None, ) ret = test._endpoint_from_url(test.url) self.assertEqual(ret.name, "test-endpoint")
def test_endpoint_from_url_with_plugins_and_directory_in_base_url_behind_external_proxy(self): api = Mock() api.base_url = "http://example.com/testing/api" api.external_proxy = True test = Record( { "id": 123, "name": "test", "url": "http://localhost:8080/testing/api/plugins/test-app/test-endpoint/1/", }, api, None, ) ret = test._endpoint_from_url(test.url) self.assertEqual(ret.name, "test-endpoint")
def test_endpoint_from_url_with_plugins(self): api = Mock() api.base_url = "http://localhost:8080/api" api.external_proxy = False test = Record( { "id": 123, "name": "test", "url": "http://localhost:8080/api/plugins/test-app/test-endpoint/1/", }, api, None, ) ret = test._endpoint_from_url(test.url) self.assertEqual(ret.name, "test-endpoint")