Skip to content

Commit

Permalink
Code cleaning with black lib!
Browse files Browse the repository at this point in the history
  • Loading branch information
amindadgar committed Jun 16, 2023
1 parent 971890d commit c183689
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
7 changes: 3 additions & 4 deletions tests/unit/test_mongodb.py
Original file line number Diff line number Diff line change
@@ -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
assert mongodb.client is None
19 changes: 10 additions & 9 deletions tests/unit/test_saga_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
assert saga_dict["updatedAt"] is not None

0 comments on commit c183689

Please sign in to comment.