def test_sanitize_components_one_element(self): ''' Tests a single component to be sanitized. ''' mock_component_list = ['foo=bar', 'api_key=abcdefghijklmnop'] mock_ret = 'foo=bar&api_key=XXXXXXXXXX&' ret = http._sanitize_url_components(mock_component_list, 'api_key') self.assertEqual(ret, mock_ret)
def test_sanitize_components_multiple_elements(self): ''' Tests two componenets to be sanitized. ''' mock_component_list = ['foo=bar', 'foo=baz', 'api_key=testing'] mock_ret = 'foo=XXXXXXXXXX&foo=XXXXXXXXXX&api_key=testing&' ret = http._sanitize_url_components(mock_component_list, 'foo') self.assertEqual(ret, mock_ret)
def test_sanitize_components_multiple_elements(self): """ Tests two componenets to be sanitized. """ mock_component_list = ["foo=bar", "foo=baz", "api_key=testing"] mock_ret = "foo=XXXXXXXXXX&foo=XXXXXXXXXX&api_key=testing&" ret = http._sanitize_url_components(mock_component_list, "foo") self.assertEqual(ret, mock_ret)
def test_sanitize_components_no_elements(self): ''' Tests when zero elements need to be sanitized. ''' mock_component_list = ['foo=bar', 'bar=baz', 'hello=world'] mock_ret = 'foo=bar&bar=baz&hello=world&' ret = http._sanitize_url_components(mock_component_list, 'api_key') self.assertEqual(ret, mock_ret)
def test_sanitize_components_one_element(self): """ Tests a single component to be sanitized. """ mock_component_list = ["foo=bar", "api_key=abcdefghijklmnop"] mock_ret = "foo=bar&api_key=XXXXXXXXXX&" ret = http._sanitize_url_components(mock_component_list, "api_key") self.assertEqual(ret, mock_ret)
def test_sanitize_components_no_elements(self): """ Tests when zero elements need to be sanitized. """ mock_component_list = ["foo=bar", "bar=baz", "hello=world"] mock_ret = "foo=bar&bar=baz&hello=world&" ret = http._sanitize_url_components(mock_component_list, "api_key") self.assertEqual(ret, mock_ret)