freeleaps-service-hub/apps/notification/tests/integration_tests/README.md

1.4 KiB

api-test

# run the command

cd notification
source local.env 
python webapi/main.py &

After running the commands, the notification api will start

create the data of template message and email senders in mongodb

test the interfaces under webapi/routes/template_message.py & email_sender.py

can comment and uncomment some lines in async def run_all_tests(self) to test certain interfaces

# run the command
cd tests/integration_tests
export PYTHONPATH="/yourpath/freeleaps-service-hub/apps/notification
source ../../local.env 
python test_email_sender_real.py 
python test_template_message_real.py

After running the commands, the template message and email sender will stored in the mongodb

Based on the template message and email sender, test the interfaces under webapi/routes/

tenant_notification.py

can comment and uncomment some lines in async def run_all_tests(self) to test certain interfaces

test_recipient_emails can be set as the true email addresses

# run the command
python test_tenant_notification_real.py

After running the commands, email will be sent

Q & A

Q: Why is the email sent twice?

Q: Why do I recieve 2 identical emails at the same time

A: when use local mongodb_uri, use exchange_name_format = "freeleaps.notification.exchange.local.{} in infra/rabbitmq/async_client.py.

while exchange_name_format = "freeleaps.notification.exchange.{}" for alpha mongodb_uri.