Merge "Get rid of ddt"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2026-10-02 11:14:17 +00:00
commit e5c2d447f3
2 files changed
+33 -57

No files matched your search

-1
View File
@@ -3,5 +3,4 @@ coverage>=3.6 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
pifpaf>=0.10.0 # Apache-2.0
stestr>=2.0.0
ddt>=1.2.1 # MIT
requests>=2.10.0 # Apache-2.0
+33 -56
View File
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import ddt
from testtools import testcase
from unittest import mock
@@ -22,61 +21,39 @@ import tooz.drivers.etcd3gw as etcd3gw_driver
import tooz.tests
@ddt.ddt
class TestEtcd3Gw(testcase.TestCase):
FAKE_MEMBER_ID = tooz.tests.get_random_uuid()
@ddt.data(
{
'coord_url': 'etcd3+http://',
'protocol': 'http',
'host': etcd3gw_driver.Etcd3Driver.DEFAULT_HOST,
'port': etcd3gw_driver.Etcd3Driver.DEFAULT_PORT,
'ca_cert': None,
'cert_key': None,
'cert_cert': None,
'api_path': None,
'timeout': etcd3gw_driver.Etcd3Driver.DEFAULT_TIMEOUT,
},
{
'coord_url': (
'etcd3+https://my_host:666?ca_cert=/my/ca_cert&'
'cert_key=/my/cert_key&cert_cert=/my/cert_cert&'
'timeout=42&api_version=v3alpha'
),
'protocol': 'https',
'host': 'my_host',
'port': 666,
'ca_cert': '/my/ca_cert',
'cert_key': '/my/cert_key',
'cert_cert': '/my/cert_cert',
'api_path': '/v3alpha/',
'timeout': 42,
},
)
@ddt.unpack
@mock.patch('etcd3gw.client')
def test_etcd3gw_client_init(
self,
mock_etcd3gw_client,
coord_url,
protocol,
host,
port,
ca_cert,
cert_key,
cert_cert,
api_path,
timeout,
):
tooz.coordination.get_coordinator(coord_url, self.FAKE_MEMBER_ID)
mock_etcd3gw_client.assert_called_with(
host=host,
port=port,
protocol=protocol,
ca_cert=ca_cert,
cert_key=cert_key,
cert_cert=cert_cert,
api_path=api_path,
timeout=timeout,
def test_etcd3gw_client_init(self, mock_etcd3gw_client):
tooz.coordination.get_coordinator(
'etcd3+http://',
tooz.tests.get_random_uuid(),
)
mock_etcd3gw_client.assert_called_with(
host=etcd3gw_driver.Etcd3Driver.DEFAULT_HOST,
port=etcd3gw_driver.Etcd3Driver.DEFAULT_PORT,
protocol='http',
ca_cert=None,
cert_key=None,
cert_cert=None,
api_path=None,
timeout=etcd3gw_driver.Etcd3Driver.DEFAULT_TIMEOUT,
)
@mock.patch('etcd3gw.client')
def test_etcd3gw_client_init_with_params(self, mock_etcd3gw_client):
tooz.coordination.get_coordinator(
'etcd3+https://my_host:666?ca_cert=/my/ca_cert&'
'cert_key=/my/cert_key&cert_cert=/my/cert_cert&'
'timeout=42&api_version=v3alpha',
tooz.tests.get_random_uuid(),
)
mock_etcd3gw_client.assert_called_with(
host='my_host',
port=666,
protocol='https',
ca_cert='/my/ca_cert',
cert_key='/my/cert_key',
cert_cert='/my/cert_cert',
api_path='/v3alpha/',
timeout=42,
)