From c183689535439b1c52df08dfaf7d7f29be1882a0 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Dadgar Date: Fri, 16 Jun 2023 10:18:09 +0330 Subject: [PATCH] Code cleaning with black lib! --- tests/unit/test_mongodb.py | 7 +++---- tests/unit/test_saga_base.py | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/unit/test_mongodb.py b/tests/unit/test_mongodb.py index d9ca26f..d5e1259 100644 --- a/tests/unit/test_mongodb.py +++ b/tests/unit/test_mongodb.py @@ -1,16 +1,15 @@ from tc_messageBroker.rabbit_mq.db_operations.mongodb import MongoDB + def test_mongo_class(): connection_url = "connection_str" db_name = "Sagas" collection_name = "saga" mongodb = MongoDB( - connection_str = connection_url, - db_name = db_name, - collection_name = collection_name + connection_str=connection_url, db_name=db_name, collection_name=collection_name ) assert mongodb.connection_str == connection_url assert mongodb.db_name == db_name assert mongodb.collection_name == collection_name - assert mongodb.client is None \ No newline at end of file + assert mongodb.client is None diff --git a/tests/unit/test_saga_base.py b/tests/unit/test_saga_base.py index 9ea8bc5..c830860 100644 --- a/tests/unit/test_saga_base.py +++ b/tests/unit/test_saga_base.py @@ -116,23 +116,25 @@ def test_choreagraphy_sorting_status_random_choreogprahy(): else: condition = True + def test_saga_create_data(): - saga_data = { - "guild": "some_guildId" - } + saga_data = {"guild": "some_guildId"} creation_date = datetime.now() saga = Saga( ChoreographyDict.DISCORD_UPDATE_CHANNELS, Status.NOT_STARTED, - data = saga_data, - created_at = creation_date, + data=saga_data, + created_at=creation_date, ) saga_dict = saga._create_data() - assert saga_dict["choreography"]["name"] == ChoreographyDict.DISCORD_UPDATE_CHANNELS.name - + assert ( + saga_dict["choreography"]["name"] + == ChoreographyDict.DISCORD_UPDATE_CHANNELS.name + ) + ## we had a list of transactions for idx, tx in enumerate(saga_dict["choreography"]["transactions"]): predefined_tx = ChoreographyDict.DISCORD_UPDATE_CHANNELS.transactions[idx] @@ -153,10 +155,9 @@ def test_saga_create_data(): assert predefined_tx.runtime is None assert predefined_tx.error is None - # assert saga_dict["choreography"]["transactions"] == ChoreographyDict.DISCORD_UPDATE_CHANNELS.transactions assert saga_dict["status"] == Status.NOT_STARTED assert saga_dict["data"] == saga_data assert saga_dict["sagaId"] == saga.uuid assert saga_dict["createdAt"] == creation_date - assert saga_dict["updatedAt"] is not None \ No newline at end of file + assert saga_dict["updatedAt"] is not None