Beispiel #1
0
 def test_strings_are_parsed_for_scheme(self):
     self.assertEquals(
         [
             {
                 "host": "elastic.co",
                 "port": 42,
                 "use_ssl": True,
             },
             {
                 "host": "elastic.co",
                 "http_auth": "user:secret",
                 "use_ssl": True,
                 "port": 443,
                 'url_prefix': '/prefix'
             }
         ],
         _normalize_hosts(["https://elastic.co:42", "https://*****:*****@elastic.co/prefix"])
     )
Beispiel #2
0
 def test_none_uses_defaults(self):
     self.assertEquals([{}], _normalize_hosts(None))
Beispiel #3
0
 def test_single_string_is_wrapped_in_list(self):
     self.assertEquals(
         [{"host": "elastic.co"}],
         _normalize_hosts("elastic.co")
     )
Beispiel #4
0
 def test_dicts_are_left_unchanged(self):
     self.assertEquals([{"host": "local", "extra": 123}], _normalize_hosts([{"host": "local", "extra": 123}]))
Beispiel #5
0
 def test_strings_are_parsed_for_port_and_user(self):
     self.assertEquals(
         [{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secre]"}],
         _normalize_hosts(["elastic.co:42", "user:secre%[email protected]"])
     )
Beispiel #6
0
 def test_strings_are_used_as_hostnames(self):
     self.assertEquals([{"host": "elastic.co"}], _normalize_hosts(["elastic.co"]))