def test_list_application_from_luis_endpoint_bad_arguments(self) -> None: application_endpoint_data: List[str] = [ "this.is.not.a.uri", "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/b31aeaf3-3511-495b-a07f-571fc873214b?verbose=true&timezoneOffset=-360&q=", "https://westus.api.cognitive.microsoft.com?verbose=true&timezoneOffset=-360&subscription-key=048ec46dc58e495482b0c447cfdbd291&q=", ] for application_endpoint in application_endpoint_data: with self.subTest(application_endpoint=application_endpoint): with self.assertRaises(ValueError): LuisApplication.from_application_endpoint( application_endpoint)
def test_list_application_from_luis_endpoint(self) -> None: # Arrange # Note this is NOT a real LUIS application ID nor a real LUIS subscription-key # theses are GUIDs edited to look right to the parsing and validation code. endpoint = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/b31aeaf3-3511-495b-a07f-571fc873214b?verbose=true&timezoneOffset=-360&subscription-key=048ec46dc58e495482b0c447cfdbd291&q=" # Act app = LuisApplication.from_application_endpoint(endpoint) # Assert self.assertEqual("b31aeaf3-3511-495b-a07f-571fc873214b", app.application_id) self.assertEqual("048ec46dc58e495482b0c447cfdbd291", app.endpoint_key) self.assertEqual("https://westus.api.cognitive.microsoft.com", app.endpoint)