def test_having_port(self): """basic auth creds correctly stripped from URL containing creds even if URL contains port""" url = 'https://*****:*****@domain.com:8080/project/objects.inv' expected = 'https://domain.com:8080/project/objects.inv' actual = _strip_basic_auth(url) self.assertEqual(expected, actual)
def test_no_auth(self): """url unchanged if param doesn't contain basic auth creds""" url = "https://domain.com/project/objects.inv" expected = "https://domain.com/project/objects.inv" actual_url, actual_username, actual_password = _strip_basic_auth(url) self.assertEqual(expected, actual_url) self.assertEqual(None, actual_username) self.assertEqual(None, actual_password)
def test_auth_stripped(self): """basic auth creds stripped from URL containing creds""" url = "https://*****:*****@domain.com/project/objects.inv" expected = "https://domain.com/project/objects.inv" actual_url, actual_username, actual_password = _strip_basic_auth(url) self.assertEqual(expected, actual_url) self.assertEqual("user", actual_username) self.assertEqual("12345", actual_password)
def test_no_auth(self): """url unchanged if param doesn't contain basic auth creds""" url = 'https://domain.com/project/objects.inv' expected = 'https://domain.com/project/objects.inv' actual_url, actual_username, actual_password = _strip_basic_auth(url) self.assertEqual(expected, actual_url) self.assertEqual(None, actual_username) self.assertEqual(None, actual_password)
def test_auth_stripped(self): """basic auth creds stripped from URL containing creds""" url = 'https://*****:*****@domain.com/project/objects.inv' expected = 'https://domain.com/project/objects.inv' actual_url, actual_username, actual_password = _strip_basic_auth(url) self.assertEqual(expected, actual_url) self.assertEqual('user', actual_username) self.assertEqual('12345', actual_password)
def test_no_auth(self): """url unchanged if param doesn't contain basic auth creds""" url = 'https://domain.com/project/objects.inv' expected = 'https://domain.com/project/objects.inv' actual = _strip_basic_auth(url) self.assertEqual(expected, actual)
def test_auth_stripped(self): """basic auth creds stripped from URL containing creds""" url = 'https://*****:*****@domain.com/project/objects.inv' expected = 'https://domain.com/project/objects.inv' actual = _strip_basic_auth(url) self.assertEqual(expected, actual)