From fbeffd406e82271f18645c6038da989f5ee8884f Mon Sep 17 00:00:00 2001 From: Ashwin Thanaraj <37061471+ashwin1111@users.noreply.github.com> Date: Tue, 24 Dec 2024 13:47:54 +0530 Subject: [PATCH] fix: Typo in function name (#18) --- producer/main.py | 2 +- setup.py | 2 +- tests/test_event_producer.py | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/producer/main.py b/producer/main.py index 6f72418..ef448b3 100644 --- a/producer/main.py +++ b/producer/main.py @@ -56,7 +56,7 @@ def produce(pg_host, pg_port, pg_database, pg_user, pg_password, pg_replication_ @click.option('--pg_publication_name', default=lambda: os.environ.get('PGPUBLICATION', None), required=False, help='Restrict to specific publications e.g. events') @click.option('--rabbitmq_url', default=lambda: os.environ.get('RABBITMQ_URL', None), required=True, help='RabbitMQ url ($RABBITMQ_URL)') @click.option('--rabbitmq_exchange', default=lambda: os.environ.get('RABBITMQ_EXCHANGE', None), required=True, help='RabbitMQ exchange ($RABBITMQ_EXCHANGE)') -def produce_multiple_dbs(db_configs, pg_output_plugin, pg_publication_name, rabbitmq_url, rabbitmq_exchange): +def producer_multiple_dbs(db_configs, pg_output_plugin, pg_publication_name, rabbitmq_url, rabbitmq_exchange): try: db_configs = json.loads(db_configs) validate_db_configs(db_configs) diff --git a/setup.py b/setup.py index e0962cd..9e2f86a 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ entry_points=''' [console_scripts] producer=producer.main:produce - producer_multiple_dbs=producer.main:produce_multiple_dbs + producer_multiple_dbs=producer.main:producer_multiple_dbs event_logger=consumer.main:consume ''' ) diff --git a/tests/test_event_producer.py b/tests/test_event_producer.py index 577d807..6c30d70 100644 --- a/tests/test_event_producer.py +++ b/tests/test_event_producer.py @@ -8,7 +8,7 @@ from common.qconnector.rabbitmq_connector import RabbitMQConnector from common.utils import validate_db_configs from producer.event_producer import EventProducer -from producer.main import produce_multiple_dbs +from producer.main import producer_multiple_dbs # Test init @@ -242,9 +242,9 @@ def valid_db_configs(): 'pg_replication_slot': 'events' }]) -def test_produce_multiple_dbs_success(valid_db_configs): +def test_producer_multiple_dbs_success(valid_db_configs): runner = CliRunner() - result = runner.invoke(produce_multiple_dbs, [ + result = runner.invoke(producer_multiple_dbs, [ '--db_configs', valid_db_configs, '--rabbitmq_url', 'amqp://admin:password@rabbitmq:5672/?heartbeat=0', '--rabbitmq_exchange', 'pgevents_exchange' @@ -252,9 +252,9 @@ def test_produce_multiple_dbs_success(valid_db_configs): assert result.exit_code == 0 -def test_produce_multiple_dbs_invalid_json(): +def test_producer_multiple_dbs_invalid_json(): runner = CliRunner() - result = runner.invoke(produce_multiple_dbs, [ + result = runner.invoke(producer_multiple_dbs, [ '--db_configs', 'invalid-json', '--rabbitmq_url', 'amqp://admin:password@rabbitmq:5672/?heartbeat=0', '--rabbitmq_exchange', 'pgevents_exchange' @@ -263,11 +263,11 @@ def test_produce_multiple_dbs_invalid_json(): assert "db_configs must be a valid JSON string" in str(result.__dict__) @mock.patch('producer.main.validate_db_configs') -def test_produce_multiple_dbs_invalid_config(mock_validate, valid_db_configs): +def test_producer_multiple_dbs_invalid_config(mock_validate, valid_db_configs): mock_validate.side_effect = click.BadParameter("Invalid config") runner = CliRunner() - result = runner.invoke(produce_multiple_dbs, [ + result = runner.invoke(producer_multiple_dbs, [ '--db_configs', valid_db_configs, '--rabbitmq_url', 'amqp://admin:password@rabbitmq:5672/?heartbeat=0', '--rabbitmq_exchange', 'pgevents_exchange' @@ -275,9 +275,9 @@ def test_produce_multiple_dbs_invalid_config(mock_validate, valid_db_configs): assert "Invalid config" in str(result.__dict__) -def test_produce_multiple_dbs_common_kwargs(valid_db_configs): +def test_producer_multiple_dbs_common_kwargs(valid_db_configs): runner = CliRunner() - result = runner.invoke(produce_multiple_dbs, [ + result = runner.invoke(producer_multiple_dbs, [ '--db_configs', valid_db_configs, '--pg_output_plugin', 'test_plugin', '--pg_publication_name', 'test_pub',