conftest.py

About this file

This file contains tests for creating an app session, retrieving a client of the app, creating a database, and creating a database session,

Code Issues

  • On line 30, what does ctx.push() do? Recommend adding a comment for understanding that line of code.

Code Check Report


No problems to report
                        

Documentation drawn from source code

ConfigTest Module

This module handles the setup for running tests agains the OpenRecords application.

.. _Flask Tutorial:
http://flask.pocoo.org/docs/1.0/tutorial/


app():

Create a session
Yields:
app (Flask): Instance of a Flask application


client(app: Flask):
Retrieve an instance of the Flask test_client.

.. _Flask Test Client:
http://flask.pocoo.org/docs/1.0/api/#flask.Flask.test_client

Args:
app (Flask): Instance of the Flask application

Returns:
app.test_client (Flask.test_client): Returns a client used to test the Flask application

db(app: Flask):

Create all of the database tables and yield an instance of the database.
Args:
app (Flask): Instance of the flask application.

Yields:
db (SQLAlchemy): Instance of the SQLAlchemy DB connector

session(db: SQLAlchemy):
Create a database session to be used for the function.

Args:
db (SQLAlchemy): Instance of the SQLAlchemy DB connector

Yields:
session_ (SQLAlchemy.session): Session object to be used by the function

Source code