def test_parse_multiple_hosts_invalid(self): fake_host = ['127.0.0.1:80', '192.168.0.1'] expected = (('127.0.0.1', 80), ) with mock.patch.object(etcd_db_driver.LOG, 'error') as log_err: output = etcd_db_driver._parse_hosts(fake_host) self.assertEqual(expected, output) log_err.assert_called_once_with(u'The host string %s is invalid.', '192.168.0.1')
def test_parse_multiple_hosts(self): fake_host = ['127.0.0.1:80', '192.168.0.1:8080'] expected = (('127.0.0.1', 80), ('192.168.0.1', 8080)) output = etcd_db_driver._parse_hosts(fake_host) self.assertEqual(expected, output)
def test_parse_empty(self): fake_host = [""] expected = () output = etcd_db_driver._parse_hosts(fake_host) self.assertEqual(expected, output)
def test_parse_one_host(self): fake_host = ['127.0.0.1:80'] expected = (('127.0.0.1', 80), ) output = etcd_db_driver._parse_hosts(fake_host) self.assertEqual(expected, output)
def test_parse_none(self): fake_host = [] expected = () output = _parse_hosts(fake_host) self.assertEqual(expected, output)