'Test publisher config parameters.'

def test_http_publisher_config(self):

    parsed_url = urlparse.urlparse('http:/aaa.bb/path')
    self.assertRaises(ValueError, http.HttpPublisher, self.CONF, parsed_url)
    parsed_url = urlparse.urlparse('http://aaa:bb/path')
    self.assertRaises(ValueError, http.HttpPublisher, self.CONF, parsed_url)
    parsed_url = urlparse.urlparse('http://localhost:90/path1')
    publisher = http.HttpPublisher(self.CONF, parsed_url)
    self.assertEqual(5, publisher.timeout)
    self.assertEqual(2, publisher.max_retries)
    parsed_url = urlparse.urlparse('http://localhost:90/path1?timeout=19&max_retries=4')
    publisher = http.HttpPublisher(self.CONF, parsed_url)
    self.assertEqual(19, publisher.timeout)
    self.assertEqual(4, publisher.max_retries)
    parsed_url = urlparse.urlparse('http://localhost:90/path1?timeout=19')
    publisher = http.HttpPublisher(self.CONF, parsed_url)
    self.assertEqual(19, publisher.timeout)
    self.assertEqual(2, publisher.max_retries)
    parsed_url = urlparse.urlparse('http://localhost:90/path1?max_retries=6')
    publisher = http.HttpPublisher(self.CONF, parsed_url)
    self.assertEqual(5, publisher.timeout)
    self.assertEqual(6, publisher.max_retries)
