I have a directory that contains my Python unit tests. Each unit test module is of the form test_*.py. I am attempting to make a file called all_test.py that will, you guessed it, run all files in the aforementioned test form and return the result. I have...
In brief
When testing a model class in Flask-SqlAlchemy, how can we mock the method .query.filter_by() so as to return the list of mocked model objects?
Full details
Let's say we have a model class as below code
from flask.ext.sqlalchemy import SQLAlc...
I'm running this command:
python manage.py test project.apps.app1.tests
and it causes this error:
AttributeError: 'module' object has no attribute 'tests'
Below is my directory structure. I've also added app1 to my installed apps config.
Traceba...
I'm running this command:
python manage.py test project.apps.app1.tests
and it causes this error:
AttributeError: 'module' object has no attribute 'tests'
Below is my directory structure. I've also added app1 to my installed apps config.
Traceba...
I have a Flask based webapp that occasionally creates new documents with new random keys when posting to their parent document in a certain way. The new key gets in the parent's data structure, the updated parent gets temporarily stored in the session and...
I'm searching a week how check if a checkbox is checked in selenium webdriver with python, but I find only algoritms from JAVA. I readed the webdriver docs and it dont have a answer for that. Anyone have a solution?
I'm searching a week how check if a checkbox is checked in selenium webdriver with python, but I find only algoritms from JAVA. I readed the webdriver docs and it dont have a answer for that. Anyone have a solution?
I am currently trying to write some unit tests for my Flask application. In many of my view functions (such as my login), I redirect to a new page. So for example:
@user.route('/login', methods=['GET', 'POST'])
def login():
....
return redirect(...
I am currently trying to write some unit tests for my Flask application. In many of my view functions (such as my login), I redirect to a new page. So for example:
@user.route('/login', methods=['GET', 'POST'])
def login():
....
return redirect(...
I am doing unit testing in flask with python3.
I have method that returns json:
@app.route('/doctor/book_appointment', methods=['POST'])
def some_method():
resp = {
"status": "",
"message": ""
}
return jsonify(resp)
So i...
I have code within a Flask application that uses JSONs in the request, and I can get the JSON object like so:
Request = request.get_json()
This has been working fine, however I am trying to create unit tests using Python's unittest module and I'm havin...
I have code within a Flask application that uses JSONs in the request, and I can get the JSON object like so:
Request = request.get_json()
This has been working fine, however I am trying to create unit tests using Python's unittest module and I'm havin...
I am having an issue in which all of my tests function correctly when run individually. However, when I try to run all the tests in the file, I get the error Message: Tried to run command without establishing a connection.
I know the tests work because th...