"""Integration tests for lambda function.""" import os import mysql.connector def test_invoke_check_db(): """Check ledger_db here.""" cnx = mysql.connector.connect( host=os.environ.get('MYSQL_HOST', '127.0.0.1'), port=os.environ.get('MYSQL_PORT', '18089'), database=os.environ.get('MYSQL_DB', 'royalty_accounting'), user=os.environ.get('MYSQL_USER', 'db_user'), password=os.environ.get('MYSQL_PASS', 'db_pass')) cursor = cnx.cursor() tables = ['ledger_general', 'ledger_payee'] for table in tables: cursor.execute('SELECT * FROM {}'.format(table)) cursor.fetchall() rc = cursor.rowcount assert rc == 1 cnx.close()