def test_get_auth_info_from_url_no_auth_info(): "get_auth_info_from_url() Should return an empty dictionary if no authentication info is found in the URL" # Given that I have a URL that contains authentication info url = "http://domain.org" # When I try to get the authentication information authentication_information = util.get_auth_info_from_url(url) # Then I see that the authentication information is just empty authentication_information.should.equal({})
def test_get_auth_info_from_url(): "get_auth_info_from_url() should be able to extract authentication data from a URL" # Given that I have a URL that contains authentication info url = "http://*****:*****@domain.org" # When I try to get the authentication information authentication_information = util.get_auth_info_from_url(url) # Then I see both user and password are correct authentication_information.should.equal({ 'authorization': 'Basic dXNlcjpwYXNzd29yZA=='})
def test_get_auth_info_from_url_for_proxy(): "get_auth_info_from_url() Should return the Proxy-Authorization header when proxy=True" # Given that I have a URL that contains authentication info url = "http://*****:*****@domain.org" # When I try to get the authentication information for a proxy authentication_information = util.get_auth_info_from_url(url, proxy=True) # Then I see both user and password are correct authentication_information.should.equal({ 'proxy-authorization': 'Basic dXNlcjpwYXNzd29yZA=='})
def test_get_auth_info_from_url_for_proxy(): "get_auth_info_from_url() Should return the Proxy-Authorization header when proxy=True" # Given that I have a URL that contains authentication info url = "http://*****:*****@domain.org" # When I try to get the authentication information for a proxy authentication_information = util.get_auth_info_from_url(url, proxy=True) # Then I see both user and password are correct authentication_information.should.equal( {'proxy-authorization': 'Basic dXNlcjpwYXNzd29yZA=='})
def test_get_auth_info_from_url(): "get_auth_info_from_url() should be able to extract authentication data from a URL" # Given that I have a URL that contains authentication info url = "http://*****:*****@domain.org" # When I try to get the authentication information authentication_information = util.get_auth_info_from_url(url) # Then I see both user and password are correct authentication_information.should.equal( {'authorization': 'Basic dXNlcjpwYXNzd29yZA=='})