def test_format_incorrect_endpoint(self): # https://github.com/Azure/azure-sdk-for-python/pull/12106 client = PipelineClientBase('{Endpoint}/text/analytics/v3.0') with pytest.raises(ValueError) as exp: client.format_url("foo/bar") assert str( exp.value ) == "The value provided for the url part Endpoint was incorrect, and resulted in an invalid url"
def test_format_url_no_base_url(self): client = PipelineClientBase(None) formatted = client.format_url("https://google.com/subpath/{foo}", foo="bar") assert formatted == "https://google.com/subpath/bar"
def test_format_url_full_url(self): client = PipelineClientBase("https://bing.com/path") formatted = client.format_url("https://google.com/subpath/{foo}", foo="bar") assert formatted == "https://google.com/subpath/bar"
def test_format_url_extra_path_missing_values_with_query(self): client = PipelineClientBase("https://bing.com/path?query=testvalue&x=2ndvalue") formatted = client.format_url("/subpath/{foo}") assert formatted == "https://bing.com/path/subpath?query=testvalue&x=2ndvalue"
def test_format_url_extra_path_missing_values(self): client = PipelineClientBase("https://bing.com/path") formatted = client.format_url("/subpath/{foo}") assert formatted == "https://bing.com/path/subpath"
def test_format_url_complex_params(self): client = PipelineClientBase("https://bing.com/path") formatted = client.format_url("/subpath/{a}/{b}/foo/{c}/bar", a="X", c="Y") assert formatted == "https://bing.com/path/subpath/X/foo/Y/bar"
def test_format_url_with_query(self): client = PipelineClientBase("https://bing.com/path?query=testvalue&x=2ndvalue") formatted = client.format_url("/{foo}", foo="bar") assert formatted == "https://bing.com/path/bar?query=testvalue&x=2ndvalue"
def test_format_url_basic(self): client = PipelineClientBase("https://bing.com") formatted = client.format_url("/{foo}", foo="bar") assert formatted == "https://bing.com/bar"
def test_format_url_extra_path(): client = PipelineClientBase("https://bing.com/path") formatted = client.format_url("/subpath/{foo}", foo="bar") assert formatted == "https://bing.com/path/subpath/bar"
def test_format_url_missing_param_values(): client = PipelineClientBase("https://bing.com/path") formatted = client.format_url("/{foo}") assert formatted == "https://bing.com/path"