def test_app_execute_sql_results_module3(): execute_sql_function = "execute_sql" in dir(app) assert execute_sql_function, "Have you defined a function named `execute_sql`?" fetchall = "fetchall" in get_functions(app.execute_sql) assert fetchall, "Have you called the `fetchall` function in `execute_sql`?" fetchone = "fetchone" in get_functions(app.execute_sql) assert fetchone, "Have you called the `fetchone` function in `execute_sql`?" commit = "commit" in get_functions(app.execute_sql) assert commit, "Have you called the `commit` function in `execute_sql`?" close = "close" in get_functions(app.execute_sql) assert close, "Have you called the `close` function in `execute_sql`?" if_statement = len(get_statements(app.execute_sql)) >= 0 assert if_statement, "Have created an if statement in the `execute_sql` function?" results_exists = "results" == get_statements( app.execute_sql)[0]["body/targets/id"] assert ( results_exists ), "Have you assigned the `results` variable to `connection.commit()`?" with app.app.app_context(): results = type(app.execute_sql("SELECT * FROM job", single=True)) != list assert ( results ), "Have you create an if statement to only return one result in `one` is true?"
def test_app_execute_sql_results_module3(): assert 'execute_sql' in dir( app), 'Have you defined a function named `execute_sql`.' assert 'fetchall' in get_functions( app.execute_sql ), 'Have you called the `fetchall` function in `execute_sql`?' assert 'fetchone' in get_functions( app.execute_sql ), 'Have you called the `fetchone` function in `execute_sql`?' assert 'commit' in get_functions( app.execute_sql ), 'Have you called the `close` function in `execute_sql`?' assert 'close' in get_functions( app.execute_sql ), 'Have you called the `close` function in `execute_sql`?' assert len( get_statements(app.execute_sql) ) >= 0, 'Have created an if statement in the `execute_sql` function?' assert 'results' == get_statements(app.execute_sql)[0][ 'body/targets/id'], 'Have you assigned the `results` variable to `connection.commit()`?' with app.app.app_context(): results = app.execute_sql('SELECT * FROM job', single=True) assert type( results ) != list, 'Have you create an if statement to only return one result in `one` is true?'