Пример #1
0
    def test_ssl_not_ssl(self):
        url = 'amqp://*****:*****@redhat.com:1234'

        # test
        b = Connector(url)
        ssl = Connection.ssl_domain(b)

        self.assertEqual(str(b.url), url)

        # validation
        self.assertEqual(ssl, None)
Пример #2
0
    def test_ssl_no_certs(self):
        url = TEST_URL

        # test
        b = Connector(url)
        ssl = Connection.ssl_domain(b)

        # validation
        self.assertEqual(
            ssl,
            {
                'ca_certs': None,
                'certfile': None,
                'keyfile': None,
                'cert_reqs': 0
            })
Пример #3
0
    def test_ssl_domain(self, validate):
        url = TEST_URL

        # test
        b = Connector(url)
        b.ssl.ca_certificate = 'test-ca'
        b.ssl.client_key = 'test-key'
        b.ssl.client_certificate = 'test-crt'
        ssl = Connection.ssl_domain(b)

        # validation
        validate.assert_called_once_with()
        self.assertEqual(
            ssl,
            {
                'ca_certs': b.ssl.ca_certificate,
                'cert_reqs': 2,
                'certfile': b.ssl.client_certificate,
                'keyfile': b.ssl.client_key
            })