예제 #1
0
 def test_connection_string_url_single_host_with_port(self):
     rabbitmq_url = "amqp://*****:*****@test.foo.com:5672/"
     f = env_mocker({"RABBITMQ_URL": rabbitmq_url})
     with patch.object(os, 'getenv', new=f):
         hosts, user, password, vhost, port, heartbeat = parse_url()
         self.assertEqual(user, "guest")
         self.assertEqual(password, "guest")
         self.assertEqual(vhost, "/")
         self.assertEqual(hosts, ["test.foo.com"])
         self.assertEqual(port, 5672)
         self.assertEqual(heartbeat, None)
 def test_connection_string_url_single_host_with_port(self):
     rabbitmq_url = "amqp://*****:*****@test.foo.com:5672/"
     f = env_mocker({"RABBITMQ_URL": rabbitmq_url})
     with patch.object(os, 'getenv', new=f):
         hosts, user, password, vhost, port, heartbeat = parse_url()
         self.assertEqual(user, "guest")
         self.assertEqual(password, "guest")
         self.assertEqual(vhost, "/")
         self.assertEqual(hosts, ["test.foo.com"])
         self.assertEqual(port, 5672)
         self.assertEqual(heartbeat, None)
 def test_connection_string_url_multiple_host(self):
     rabbitmq_url = "amqp://*****:*****@server1.foo.com,server2.foo.com/"
     f = env_mocker({"RABBITMQ_URL": rabbitmq_url})
     with patch.object(os, 'getenv', new=f):
         hosts, user, password, vhost, port, heartbeat = parse_url()
         self.assertEqual(user, "guest")
         self.assertEqual(password, "guest")
         self.assertEqual(vhost, "/")
         self.assertEqual(sorted(hosts),
                          ["server1.foo.com", "server2.foo.com"])
         self.assertEqual(port, 5672)
         self.assertEqual(heartbeat, None)
예제 #4
0
 def test_connection_string_url_multiple_host(self):
     rabbitmq_url = "amqp://*****:*****@server1.foo.com,server2.foo.com/"
     f = env_mocker({"RABBITMQ_URL": rabbitmq_url})
     with patch.object(os, 'getenv', new=f):
         hosts, user, password, vhost, port, heartbeat = parse_url()
         self.assertEqual(user, "guest")
         self.assertEqual(password, "guest")
         self.assertEqual(vhost, "/")
         self.assertEqual(sorted(hosts), [
             "server1.foo.com",
             "server2.foo.com"
         ])
         self.assertEqual(port, 5672)
         self.assertEqual(heartbeat, None)