Less of blog post and more of a reminder to myself. When using Flask and Unit Testing with Python, if either of the below errors occur (or something similar):
AttributeError: 'FlaskClientTestCase' object has no attribute 'client' AttributeError: 'FlaskClientTestCase' object has no attribute 'app_context'
Then it may be because the setUp function of the test class has not set up correctly. Spent some time going round in circles until I realised that def setUp(self) of the class read def setup(self), and that lower case u really needed to be an upper case U for Unit Testing to use the function to set up the class.
The above Attribute Errors were generating as the class (FlaskClientTestCase) had failed to set up, so did not have a client attribute and did not have an app_context attribute.